MyProgrammingLab (PEARSON). Chapter 3 - Ex. 70111. Average Rainfall.
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.