Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
