176k views
0 votes
Rainfall Statistics - Flowchart or pseudocode (your choice) Design a program that uses 2 parallel arrays, one array to hold the names of the months and a second array to hold the total rainfall for the month that the user will enter. Use the names of the months from the month array in your input prompt to the user so they know which month they are entering rainfall for. The program should calculate and display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts.

User Mark Denom
by
7.4k points

1 Answer

3 votes

Answer:

Here is the pseudocode for the program:

1. Create two arrays: one for the names of the months and one for the total rainfall for each month.

2. Use a loop to prompt the user to enter the amount of rainfall for each month, using the month array to display the name of the month.

3. Store the rainfall amount in the corresponding index of the rainfall array.

4. Calculate the total rainfall for the year by summing the elements of the rainfall array.

5. Calculate the average monthly rainfall by dividing the total rainfall by 12.

6. Find the index of the maximum value in the rainfall array and store it as the index of the month with the highest rainfall.

7. Find the index of the minimum value in the rainfall array and store it as the index of the month with the lowest rainfall.

8. Display the total rainfall for the year, the average monthly rainfall, and the months with the highest and lowest amounts of rainfall, using the month array to display the names of the months.

Here is the flowchart for the program:

[Start] -> [Create month array] -> [Create rainfall array] -> [Loop through months] -> [Prompt user for rainfall amount] -> [Store rainfall amount in array] -> [End loop] -> [Calculate total rainfall] -> [Calculate average monthly rainfall] -> [Find index of month with highest rainfall] -> [Find index of month with lowest rainfall] -> [Display results] -> [End]

User Katlock
by
7.5k points