Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

John wants to know the values of the area and perimeter of a rectangle. John can

ID: 1798526 • Letter: J

Question

John wants to know the values of the area and perimeter of a rectangle. John can take measurements of the length and width of the rectangle in inches. John's measurements are expected to be accurate to within 0.1 inch.

1. Identify the inputs and outputs of the problem.
Inputs: length of rectangle, width of rectangle, number1, number2
Outputs: area and perimeter of rectangle

2. Identify the processing needed to convert the inputs to the outputs.
Area = length * width
Perimeter = 2W + 2L (W = width, L = length)

3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output.


4. Identify two test cases, one using whole number values, and one using decimal number values. For each of the two test cases show what inputs you will use and what your expected outputs should be.



5. Write the program to implement your algorithm

Explanation / Answer

1. Identify the inputs and outputs of the problem. Inputs: length, width; Outputs: area, perimeter; 2. Identify the processing needed to convert the inputs to the outputs. Area = length * width Perimeter = 2W + 2L 3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output. begin define: real W,L, A, P; // W = width; L = length; A = area; P = perimeter read(W) read(L) P = 2*(W + L) A= L*W print( "area = ",A) print( "perimeter = ",P) 4. Identify two test cases, one using whole number values, and one using decimal number values. For each of the two test cases show what inputs you will use and what your expected outputs should be. imput: L=1; W=2; program output: area= 2 perimeter = 6 imput: L=4.5; W=0.5; program output: area= 2.25 perimeter = 10 5. Write the program to implement your algorithm i dont know the language that u are using, so i will make it in C #include main(){ float W,L, A, P printf(" type the length of the rectangle"); scanf ("%f,&L); printf(" type the widght of the rectangle"); scanf ("%f,&L); P = 2*(W + L); A= L*W; printf("area = %f ",A); printf("perimeter = %f ",P); }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote