Write a program that reads and processes data about


Program 1

Write a program that reads and processes data about quarterly rainfall for one year. Your program should ask the user to enter rain fall amounts for each of the four quarters in the year. You must use a looping construct to read the input for one quarter at a time until all four quarters' data has been read. The program should output the name which quarter (i.e. Quarter 1, Quarter 2, Quarter 3, or Quarter 4) had the most rainfall, which quarter had the least rainfall, the average rainfall for the entire year, and the total rainfall for the entire year. All output should be displayed with meaningful descriptions.

Program 2

Modify program 1 so that it will handle multiple years of rainfall data. The user should be asked at runtime to supply the actual number of years they want to enter in the program for evaluation. In addition to the output specified in program 1 for each individual year, program 2 should output the year (i.e. Year 1, Year 2, etc.) with the most total rainfall and the year with the least total rainfall. All output should be displayed with meaningful descriptions. You are required to use a nested looping construct for this program.

Sample output: (Your program should work properly with all positive data)

How many year's rainfall amounts would you like to enter: 2

ÏÏ ÏEnter data for year 1

Ï Enter the rainfall for quarter 1: 4

Ï Enter the rainfall for quarter 2: 2

Ï Enter the rainfall for quarter 3: 8

Ï Enter the rainfall for quarter 4: 6

ÏÏÏ

ÏÏ Ï Quarter 3 had the most rainfall with 8.0 inches

ÏÏ Ï Quarter 2 had the least rainfall with 2.0 inches

ÏÏ Ï The total rainfall for year 1 was 20.0 inches

ÏÏ Ï The average quarterly rainfall for year 1 was 5.0 inches

ÏÏ Ï

ÏÏ ÏEnter data for year 2

Ï Enter the rainfall for quarter 1: 3.1

Ï Enter the rainfall for quarter 2: 9.1

Ï Enter the rainfall for quarter 3: 5.1

Ï Enter the rainfall for quarter 4: 1.1

ÏÏÏ

ÏÏ Ï Quarter 2 had the most rainfall with 9.1 inches

ÏÏ Ï Quarter 4 had the least rainfall with 1.1 inches

ÏÏ Ï The total rainfall for year 2 was 18.4 inches

ÏÏ Ï The average quarterly rainfall for year 2 was 4.6 inches

ÏÏÏ

Ï ÏYear 1 had the most rainfall with 20.0 inches

ÏÏ ÏYear 2 had the least rainfall with 18.4 inches(hint - This program will require nested loops. The outer loop determines the year and the inner loop determines the quarter within the year. If you are having trouble understanding nested loops be sure to watch the screen cast on nested loops, it is based on an application very similar to this problem.)

Solution Preview :

Prepared by a verified Expert
Programming Languages: Write a program that reads and processes data about
Reference No:- TGS01727644

Now Priced at $40 (50% Discount)

Recommended (92%)

Rated (4.4/5)