# I need help with this programming exercise: Write a C++ console application that allows your user to capture rainfall statistics. Your program should contain an array of 12 doubles for the rainfall values as well as a parallel array containing the names of the months. Using each of the month names, prompt your user for the total rainfall for that month. The program should validate user input by guarding against rainfall values that are less than zero. After all 12 entries have been made, the program should display a list of the months and their corresponding rainfall values sorted in order by rainfall amount, from highest to lowest.

Question
192 views

I need help with this programming exercise:

Write a C++ console application that allows your user to capture rainfall statistics. Your program should contain an array of 12 doubles for the rainfall values as well as a parallel array containing the names of the months. Using each of the month names, prompt your user for the total rainfall for that month. The program should validate user input by guarding against rainfall values that are less than zero. After all 12 entries have been made, the program should display a list of the months and their corresponding rainfall values sorted in order by rainfall amount, from highest to lowest.

check_circle

Step 1

Before solving this problem our first duty is to understand what question is asking:

• Here user wants to calculate the rainfall statistics of 1year.
• Enter the value of the rainfall of the individual month.
• User also wants to check whether the value entered is greater than 0 or not.
• If the entered value is less than 0, an error message should be display that “The Value you entered is should be greater than zero.”
• Also Sort it to the ordered by the rainfall from highest to lowest.
• Finally display the list of rainfall in their respective corresponding rainfall.

For solving this problem some variables are used to define the months, total rainfall and average rain fall. Also, some data types are used to declare the variables. To check the condition is rainfall greater than 0 a loop is required and for sorting the rainfalls in a highest to lowest. setw function is used to set the width with count.

Step 2

Following are the list of Variables, Data type and the functions is used in the programs:

1. Variables: i, j, temp, rainfall, months, rain.

2. Data type: Integer, Double...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in