Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the 2 D arrays: String [ ] dates = { March 2 9 th , March 3 0 th , March
Given the D arrays: String dates March th "March th "March st "April st "April nd; and int testScores
; 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 D array of dates
private double cityTemps; The D array of temperatures for several cities
Initializes dates to the specified D array containing the dates
for each column of cityTemps and initializes cityTemps to the
specified D array of temperatures for several cities
public TemperaturesString dates, double cityTemps
this.dates dates;
this.cityTemps cityTemps;
Returns the D array of dates
public String getDates
return dates;
Returns the D array of temperatures
public double getCityTemps
return cityTemps;
public String dailyAverages return ;
Returns the date for a given column
public String getDateint column
if column dates.length
return datescolumn;
else
return "Unknown";
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