Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the 2 D arrays: String [ ] dates = { March 2 9 th , March 3 0 th , March

Given the 2D arrays: String[] dates ={"March 29th", "March 30th", "March 31st", "April 1st", "April 2nd"}; and int[][] testScores ={{85,90,80,70},
{90,80,75,85},
{70,75,80,90},
{80,90,85,75},
{75,70,80,85}}; Traverse the cityTemps array and calculate the average of each column.
Return a String containing each date and the average temperature on that day.
Use the getDate() method to get the date for each column. public class Temperatures {
private String[] dates; // The 1D array of dates
private double[][] cityTemps; // The 2D array of temperatures for several cities
/*
* Initializes dates to the specified 1D array containing the dates
* for each column of cityTemps and initializes cityTemps to the
* specified 2D array of temperatures for several cities
*/
public Temperatures(String[] dates, double[][] cityTemps){
this.dates = dates;
this.cityTemps = cityTemps;
}
/*
* Returns the 1D array of dates
*/
public String[] getDates(){
return dates;
}
/*
* Returns the 2D array of temperatures
*/
public double[][] getCityTemps(){
return cityTemps;
} public String dailyAverages(){ return "";
}
/*
* Returns the date for a given column
*/
public String getDate(int column){
if (column < dates.length){
return dates[column];
}
else {
return "Unknown";
}
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

5. Prepare a plan of action and execute itstarting now!

Answered: 1 week ago

Question

=+j Describe how EU directives impact IHRM.

Answered: 1 week ago

Question

=+and reduction in force, and intellectual property.

Answered: 1 week ago