Write a program to calculate the average temperature for


Write a program to calculate the average temperature for the year and determine the hottest month of the year.

In your main method, the program should collect the user input of the average Fahrenheit temperatures for each of the 12 months of a year into an array.

The average temperature for January will go into the 1st index position of the array, February will go into the 2nd index position, etc.

Your main method should then call a method named averageTemp, passing the entire array of temperatures to this method as the only argument. The averageTemp method should compute the average of the numbers stored in the array passed to it and return the average to the caller. Your main method should then call a method named getHotMonth, passing the entire array of temperatures to this method as well. The getHotMonth method should use the array to find the index position of the month with the hottest temperature.

If there is a tie between two months, the method should return the array index position of first month to reach the hottest temperature. Once main receives both the average and index position in the array of the hottest month, it should call a method named displayResults to display the average and hottest month to the user.

The method displayResults will accept two arguments, the average temperature and the index position in the array of the hottest month. The final output of the program should say something like, "The average temperature for the year was 45.7 degrees F with July being the hottest month."

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program to calculate the average temperature for
Reference No:- TGS02928273

Expected delivery within 24 Hours