Question: Write a program in C++ to calculate the total snowfall of the year and the total rainfall of the year. Instructions: Your program should display

Write a program in C++ to calculate the total snowfall of the year and the total rainfall of the year.

Instructions:

Your program should display a Menu to the user.

1) Enter 1 to calculate the total snowfall of the year:

2) Enter 2 to calculate the total rainfall of the year:

3) Enter 999 to quit:

Your program should do the following:

Allow the user to enter in inches the snowfall for each month. Then display the total yearly snowfall.

Allow the user to enter the rainfall in inches for each month. Then display the total yearly rainfall.

Once 999 is entered, exit the program with a thank you message.

Help:

Use do while to display the menu.

Use switch for the choice 1,2,999

Use while loop for the input and sum of snowfall.

Use while loop for the input and sum of rainfall.

Sample Output

******MENU******

Enter 1 to calculate the total snowfall of the year:

Enter 2 to calculate the total rainfall of the year:

Enter 999 to Exit Program

Enter your selection:

2

Enter rainfall for month 1

1

Enter rainfall for month 2

1

Enter rainfall for month 3

1

Enter rainfall for month 4

1

Enter rainfall for month 5

1

Enter rainfall for month 6

1

Enter rainfall for month 7

1

Enter rainfall for month 8

1

Enter rainfall for month 9

1

Enter rainfall for month 10

1

Enter rainfall for month 11

0.5

Enter rainfall for month 12

0.5

Total Yearly Rain: 11 inches.

******MENU******

Enter 1 to calculate the total snowfall of the year:

Enter 2 to calculate the total rainfall of the year:

Enter 999 to Exit Program

Enter your selection:

1

Enter snowfall for month 1

2

Enter snowfall for month 2

2

Enter snowfall for month 3

2

Enter snowfall for month 4

2

Enter snowfall for month 5

2

Enter snowfall for month 6

2

Enter snowfall for month 7

2

Enter snowfall for month 8

2

Enter snowfall for month 9

2

Enter snowfall for month 10

0.5

Enter snowfall for month 11

0.5

Enter snowfall for month 12

0.5

Total Yearly Snow: 19.5 inches.

******MENU******

Enter 1 to calculate the total snowfall of the year:

Enter 2 to calculate the total rainfall of the year:

Enter 999 to Exit Program

Enter your selection:

999

Thank You

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!