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

151hw2 (Protected View) Word Der Draw Design Layout References Mailings Review V

ID: 3743427 • Letter: 1

Question

151hw2 (Protected View) Word Der Draw Design Layout References Mailings Review View Tell me what you want to do 4. [after $2.9] Loop termination by counter method Write a pseudocode algorithm that analyzes a tree's annual growth rings. Your algorithm should initially ask the user for the number of annual growth rings that are to be entered. Usea counter loop to ensure that the loop repeats that number of times. Inside the loop, your algorithm should ask the user to enter the distance in centimeters from the tree's center for each ring, with the smaller ring values entered first. Also inside the loop, your algorithm should calculate the amount of growth that took place for the year associated with the current ring. Below the loop, print the growth for the year where the greatest growth took place Sample session: How many growth ring values are there2 6 Enter ring's distance from the center in cm 1.2 Enter ring's distance from the center in cm: 2.7 Enter ring's distance from the center in cm: 3.2 Enter ring's distance from the center in cm: 3.8 Enter ring's distance from the center in cm: 5.9 Enter ring's distance from the center in cm: 6.3 The greatest growth in one year was 2.1 a EXTRA CREDIT (I pt): rds search

Explanation / Answer

Pseudocode:

1) Get the growth ring values

2) Use for loop and set the maximum to the above ring values mentioned in first point

3) Inside for loop ask user for the distance from the center and store it in an array1

4) Take the last element in the stored array and subtract it with the consecutive elements and store the consecutive values to another array2

5) Now find the maximum value in the second array that is the highest growth in an year.

Algorithm:

Step 1 : Start

step 2: Read the growth ring values

step 2: Declare array1 of size growthringvalues

step 4 :Use for loop and set the max limit as entered values

for(int i=0;i<growthRingValue;i++)

step 5: Inside for loop Read the distance from the center for consecutive times.

step 6: store the read values in array1

arr1[6];

step7: Declare array 2 of size 5

int j=0;

arr2[5];

for(int i=5;i>0;i--)

{

arr2[j]=arr[i]-arr[i-1];

j++;

}

step 7: Find the maximum value in the arr2 is the highest growth in one year.

step 8 : Stop

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

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