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

10. (30 pts) Answer includes Analysis, pseudocode and program Write a program to

ID: 3763367 • Letter: 1

Question

10. (30 pts) Answer includes Analysis, pseudocode and program Write a program to solve the following problem. It will help if you a (inputs, outputs, equations) and write pseudocode. A large tract of land has become available in South Dakota for settlement. A settler can have all the land that he or she can run around in eight hours. The land must be in a rectangle. Figure out how much land the individual can enclose. Your program should input the speed (velocity) the person can run in meters/sec and then calculate the perimeter the person can run. Knowing that the perimeter is the length of all four sides, the area is length times width and length-(P -2W2 figure out a way to determine the length and width the person will run and the maximum area the person can enclose. Assume the person can run at the same speed all day. Output Length, width, and maximum area. Note: L x W = Area Length and W values give same area values. not all

Explanation / Answer

Let the speed be S and time is 8 hr.

so , the perimeter will be

P = S x8

Area (A) = (P-2W)/2

A = ((8xS)-(2xW))/2

Now, finding max area is simple matter of looping through 1 to P/4 for width.

Pseudo code :

1. Take input S.

2. int maxArea = 0;

3. int W = 0;

4. int P = Sx8; int maxWidth = P/4; int i = 0;

5. A = 0;

6. maxArea = A;

7. while (i < maxWidth)

{

A = i*((P-2*i)/2); // WxL where width=i and length = (P-2*i)/2

if (A > maxArea)

{

maxArea = A;

W = i;

}

}

8. L = (P - 2*W)/2; print L

9. A = LxW; print A

10. Print W;