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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education