Question: Write a program that uses a two - dimensional array to store the highest and lowest temperatures for each month of the year. The program

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.
Function averageHigh: This function calculates and returns the average 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.
Your two-dimensional array is 12 rows and 2 columns. Each row is a month. Column 0 is the low temperature and column 1 is the high temperature.
You must create 5 functions in addition to main. They must be named: getData, averageHigh, averageLow, indexHighTemp, indexLowTemp
getData will first read the 12 low temperatures, then the 12 high temperatures. Pass the array as a parameter
averageLow and averageHigh are caluculating an integer average NOT a floating point average. Make these functions return their respective average
indexLowTemp and indexHighTemp should also return an integer the index of the row with the lowest or highest temperature. This index can be used to get the highest or lowest temperature from the two dimensional array
In main(), you need to print 4 lines:
Average high temperature: followed by the average high
Average low temperature: followed by the average low
Highest temperature: followed by the highest temperature
Lowest temperature: followed by the lowest temperature
These values need to be read from a file to avoid user input

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!