Question
THIS IS JAVA FILE: public class TemperatureMonth{ private double[][] temperatures; public TemperatureMonth(double[][] t){ temperatures = t; } public double getMaxTemp(){ // Remove return and implement
THIS IS JAVA FILE:
public class TemperatureMonth{
private double[][] temperatures;
public TemperatureMonth(double[][] t){ temperatures = t; }
public double getMaxTemp(){ // Remove return and implement getMaxTemp method here return 0; }
public double getMinTemp(){ // Remove return and implement getMinTemp method here return 0; }
public double getMonthlyAverage(){ // Remove return and implement getMonthlyAverage method here return 0; }
public double[] getWeeklyAverages(){ // Remove return and implement getWeeklyAverages method here return new double[1]; }
}
This is runner code: import java.util.Scanner; public class runner_TemperatureMonth{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("Enter number of weeks:"); int rows = scan.nextInt(); System.out.println("Enter number of days in a week:"); int cols = scan.nextInt(); double[][] mat = new double[rows][cols]; System.out.println("Enter temperature values:"); for(int r = 0; r Instructions For this assignment you will complete 3 methods in the Temperature Month class. This class has a single member variable temperature which is a 2-D array of double values. Each value represents the average temperature on a single day. Each row of the matrix represents a single week, and the entire matrix represents a month. Unlike in the Gregorian calendar used in most western countries, in the calendar system used in this class months always consist of a whole number of weeks, however you may not assume that the number of days in a week is 7, or that the number of weeks in a month is 4. In other words the parameter 2-D array may have any number of rows and columns but each row will be the same length. You will implement the following methods: getMaxTemp - Returns a double equal to the highest average daily temperature in the month. getMinTemp - Returns a double equal to the lowest average daily temperature in the month. gethanthiyverage - Returns a double equal to the average temperature for the whole monthy getweeklyAverages Returns a 1-d array of doubles, where each double is the average temperature for a week (i.e. the first element is the average of the values in the first row of the temperature array, the second element is the average of the second row etc.) For example if the matrix of temperatures was as follows: 744 63.5 62.8 65.6 69.9 70.9 77.3 75.0 79.5 65.4 79.4 63.8 62.1 77.5 711 68.1 62.0 71.5 60.1 76.7 74.1 71.0 616 73.2 77.2 66.9 62.7 71.4 Then the returns of these methods should be: getMaxTemp: 79.5 eetMinTemp : 60.1 get MonthiyAverage : 69.81071428571428 getWeeklyAverages : {69.19999999999999.71.81428571428572,69.08571428571429.69.14285714285714 Use the runner class to test your methods but do not add a main method to your Temperature Month.java file or your code will not be scored correctly. Files STATUS NOT SUBMITTED SAVE SUBMIT INSTRUCTIONS RUN CODE GRADING HISTORY 1 - public class TemperatureMonth{ TemperatureMonth.java private double[][] temperatures; I 4 . runner Temperature Mont... 6 7 8 public TemperatureMonth (double[1] t) { temperatures = t; } public double getMaxTemp() { // Remove return and implement getMaxTemp method here return ; } For this assignment you will complete 3 methods in the TemperatureMonth class. This class has a single member variable temperature which is a 2-D array of double values. Each value represents the average temperature on a single day. Each row of the matrix represents a single week, and the entire matrix represents a month public double getMinTemp() { // Remove return and implement getMinTemp method here return 0; } 1e 11 12 13 14 - 15 16 17 18 19- 20 21 22 23 24- 25 26 27 28 29 30 public double get IyAverage(){ 11 Remove return and implement getMonthlyAverage method here return 0; } public double[] getWeeklyAverages(){ IT Remove return and implement getWeeklyAverages method here return new double[1]; 3 Unlike in the Gregorian calendar used in most western countries, in the calendar system used in this class months always consist of a whole number of weeks, however you may not assume that the number of days in a week is 7 or that the number of weeks in a month is 4. In other words the parameter 2-D array may have any number of rows and columns but each row will be the same length You will implement the following methods. getMaxTemp - Returns a double equal to the highest average daily temperature in the month K2 KY Files STATUS NOT SUBMITTED > SAVE SUBMIT INSTRUCTIONS RUN CODE GRADING HISTORY Temperature Month.java runner TemperatureMont... For this assignment you will complete 3 methods in the TemperatureMonth class. This class has a single member variable temperature which is a 2-D array of double values. Each value represents the average temperature on a single day. Each row of the matrix represents a single week, and the entire matrix represents a month. 1- import java.util.Scanner; 2 - public class runner_TemperatureMonth 3- public static void main(String[] args) { 4 Scanner scan = new Scanner(System.in); 5 System.out.println("Enter number of weeks:"); 6 int rows = scan.nextInt(); T 7 System.out.println("Enter number of days in a week :"); 8 int cols = scan.nextInt(); 9 double[][] mat = new double[rows][cols]; 10 System.out.println("Enter temperature values:"); 11 - for(int r = 0; r
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started