Rainfall Statistics Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions: Function getData: This function reads and stores data in the two- dimensional array. The program should verify that the user entered a number and that the high number is higher than the low number for a month. Function averageHigh: This function calculates and returns the aver- age high temperature for the year. Function averageLow: This function calculates and returns the average low temperature for the year. Function indexHighTemp: This function returns the index of the highest high temperature in the array. Function indexLowTemp: This function returns the index of the lowest low temperature in the array. These functions must all have the appropriate parameters. INPUT VALIDATION: Numbers should be numbers.  The high number for a month should be higher than the low number for a month.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter3: Assignment, Formatting, And Interactive Input
Section: Chapter Questions
Problem 6PP: (Heat transfer) The formula developed in Exercise 5 can be used to determine the cooling time, t,...
icon
Related questions
Question

C++

Rainfall Statistics

Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions:

  1. Function getData: This function reads and stores data in the two- dimensional array. The program should verify that the user entered a number and that the high number is higher than the low number for a month.
  2. Function averageHigh: This function calculates and returns the aver- age high temperature for the year.
  3. Function averageLow: This function calculates and returns the average low temperature for the year.
  4. Function indexHighTemp: This function returns the index of the highest high temperature in the array.
  5. Function indexLowTemp: This function returns the index of the lowest low temperature in the array.

These functions must all have the appropriate parameters.

INPUT VALIDATION: Numbers should be numbers.  The high number for a month should be higher than the low number for a month.

Sample Output:

Enter the highest temperature for the month of January: 91.9
Enter the lowest temperature for the month of January: -13.8
Enter the highest temperature for the month of February: 72.6
Enter the lowest temperature for the month of February: 44
Enter the highest temperature for the month of March: -29.1
Enter the lowest temperature for the month of March: 91.1
Error: The first temp must be higher than the second
Enter the highest temperature for the month of March: 97.1
Enter the lowest temperature for the month of March: -29.1
Enter the highest temperature for the month of April: 79.8
Enter the lowest temperature for the month of April: -16.4
Enter the highest temperature for the month of May: a
Enter the lowest temperature for the month of May:
Brror: You entered something that is not a number.
Enter the highest temperature for the month of May: 85.0
Enter the lowest temperature for the month of May: 34.6
Enter the highest temperature for the month of June: 60
Enter the lowest temperature for the month of June: 33.4
Enter the highest temperature for the month of July: 80.9
Enter the lowest temperature for the month of July: 78.1
Enter the highest temperature for the month of August: 92.0
Enter the lowest temperature for the month of August: 43.0
Enter the highest temperature for the month of September: 92
Enter the lowest temperature for the month of September: 91.0
Enter the highest temperature for the month of October: 78.9
Enter the lowest temperature for the month of October: 34.9
Enter the highest temperature for the month of November: 98.6
Transcribed Image Text:Enter the highest temperature for the month of January: 91.9 Enter the lowest temperature for the month of January: -13.8 Enter the highest temperature for the month of February: 72.6 Enter the lowest temperature for the month of February: 44 Enter the highest temperature for the month of March: -29.1 Enter the lowest temperature for the month of March: 91.1 Error: The first temp must be higher than the second Enter the highest temperature for the month of March: 97.1 Enter the lowest temperature for the month of March: -29.1 Enter the highest temperature for the month of April: 79.8 Enter the lowest temperature for the month of April: -16.4 Enter the highest temperature for the month of May: a Enter the lowest temperature for the month of May: Brror: You entered something that is not a number. Enter the highest temperature for the month of May: 85.0 Enter the lowest temperature for the month of May: 34.6 Enter the highest temperature for the month of June: 60 Enter the lowest temperature for the month of June: 33.4 Enter the highest temperature for the month of July: 80.9 Enter the lowest temperature for the month of July: 78.1 Enter the highest temperature for the month of August: 92.0 Enter the lowest temperature for the month of August: 43.0 Enter the highest temperature for the month of September: 92 Enter the lowest temperature for the month of September: 91.0 Enter the highest temperature for the month of October: 78.9 Enter the lowest temperature for the month of October: 34.9 Enter the highest temperature for the month of November: 98.6
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage