Write a program that uses a two dimensional array to store the highest and lowest temperatures for each month of the calendar year. The temperatures will be entered at the keyboard. This program must output the average high, average low, and highest and lowest temperatures of the year. The results will be printed on the console. The program must include the following methods: A method named inputTempForMonth whose purpose is to input a high and a low temperature for a specific month. The month and the array of temperatures will both be passed as input arguments to the method. The method will not have a return value. A method named inputTempForYear whose purpose is to input a high and a low temperature for every month of the year. There are no input arguments for this method, but the method does return a completed multidimensional array of temperatures for the year. A method named calculateAverageHigh whose purpose is to calculate the average high temperature for the year. This method will take the array of temperatures as input and will return the average high temperature for the year. A method named calculateAverageLow whose purpose is to calculate the average low temperature for the year. This method will take the array of temperatures as input and will return the average low temperature for the year. A method named findHighestTemp whose purpose is to return the index value of the highest temperature for the year. If the highest temperature of the year occurs more than once in the year, then the method should return the index of the first month that had the temperature. The method will take the array of temperatures as an input argument and return the index of the highest temperature. A method named findLowestTemp whose purpose is to return the index value of the lowest temperature for the year. If the lowest temperature of the year occurs more than once in the year, then the method should return the index of the first month that had the temperature. The method will take the array of temperatures as an input argument and return the index of the lowest temperature. A main method that uses the previous methods to determine the average high temperature, average low temperature, and highest and lowest temperatures for the year. The main method must print out these average temperatures as well as the month and temperature for the highest and lowest temperatures for the year.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

JAVA Programming Problem 3 - Temperatures

Write a program that uses a two dimensional array to store the highest and lowest temperatures for each month of the calendar year. The temperatures will be entered at the keyboard. This program must output the average high, average low, and highest and lowest temperatures of the year. The results will be printed on the console. The program must include the following methods:

  • A method named inputTempForMonth whose purpose is to input a high and a low temperature for a specific month. The month and the array of temperatures will both be passed as input arguments to the method. The method will not have a return value.
  • A method named inputTempForYear whose purpose is to input a high and a low temperature for every month of the year. There are no input arguments for this method, but the method does return a completed multidimensional array of temperatures for the year.
  • A method named calculateAverageHigh whose purpose is to calculate the average high temperature for the year. This method will take the array of temperatures as input and will return the average high temperature for the year.
  • A method named calculateAverageLow whose purpose is to calculate the average low temperature for the year. This method will take the array of temperatures as input and will return the average low temperature for the year.
  • A method named findHighestTemp whose purpose is to return the index value of the highest temperature for the year. If the highest temperature of the year occurs more than once in the year, then the method should return the index of the first month that had the temperature. The method will take the array of temperatures as an input argument and return the index of the highest temperature.
  • A method named findLowestTemp whose purpose is to return the index value of the lowest temperature for the year. If the lowest temperature of the year occurs more than once in the year, then the method should return the index of the first month that had the temperature. The method will take the array of temperatures as an input argument and return the index of the lowest temperature.
  • A main method that uses the previous methods to determine the average high temperature, average low temperature, and highest and lowest temperatures for the year. The main method must print out these average temperatures as well as the month and temperature for the highest and lowest temperatures for the year.

Directions

  • You may only use statements that are discussed in the book through Chapter 7.
  • You must not use an ArrayList class from Java libraries to solve this problem.
  • Console input and output must be used to solve this problem.
  • Use the following input values for the final test of this program:
  • January has a High of 40 and Low of -10
  • February has a High of 55 and Low of 25
  • March has a High of 60 and Low of 40
  • April has a High of 88 and Low of 20
  • May has a High of 72 and Low of 55
  • June has a High of 95 and Low of 80
  • July has a High of 97 and Low of 87
  • August has a High of 110 and Low of 98
  • September has a High of 79 and Low of 68
  • October has a High of 31 and Low of 30
  • November has a High of 58 and Low of -25
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY