Question: Hello, this is a CodeLab question from my C++ (object oriented) class. If you can make the program simple and not too complicated for me

Hello, this is a CodeLab question from my C++ (object oriented) class. If you can make the program simple and not too complicated for me and also my teacher to understand, that would be great. Thank you so much!

Write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of a data file that that contains rainfall data for three months. The file consists of three lines, each with the name of a month, followed by one or more spaces, followed by the rainfall for that month. The program opens the file, reads its contents and then displays a message like:

The average rainfall for June, July, and August is 6.72 inches.

Prompts And Output : The program prompts the user with the string "Enter filename with monthly data: ". The output should be of the form: "The average rainfall for MONTH1, MONTH2, and MONTH3 is: AVERAGE" where MONTH1, MONTH2, and MONTH3 are the month names that were read from the datafile user and where AVERAGE is the average rainfall calculated from the file's rainfall data and shown with exactly two digits past the decimal point.

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!