Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help debugging, whenever I run this on my assignment server I get null exception error for these three methods shown. atherStation.java BuildDatabase.java se.javaWeatherReport.java

image text in transcribed

image text in transcribed

image text in transcribed

I need help debugging, whenever I run this on my assignment server I get null exception error for these three methods shown.

atherStation.java BuildDatabase.java se.javaWeatherReport.java Temperature.java 104 185 186 187 WeatherDatabase.java Compare.java E Untitled-1 x returns the highest temperature ever recorded by any weather station in the data base public Temperature getMaxTemperature)i 109 110 Temperature naxtempTemperaturel-273.15) Temperature temp: for(int 1-;iegetWeatherstations().length;1++) 112 113 114 115 116 if(maxtenp = null){ maxtenp getkeatherStations() [i].getReportwithMaxTemp.getTenperature); temp = getweatherStations() [1].getReportWithMaxTemp().getTenperature(); if (Compare.compare(maxtenp,temp)1) maxtenp-tenp: 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 return maxtenp: returns the highest temperature on a specified day that is recorded in a report in the weather stations in this database. *@param day is the day to find the max tenperature on. Note that this night be the special max temperature day that a weather station records ereturn the temperature object with the highest recorded Temperature in the data base on the specified day public Temperature getMaxTemperature(int day) Temperature naxtempl = null; Temperature tenp: for(int i-;isgetWeatherStationsO.length;i++) if (getweatherStations() [i].getReportwithMaxTenp().getTime(0.getDayday) if(maxtempi null){ - naxtempl-getweatherStations() [i].getReportwithMaxTemp().getTemperature) elset temp = getweatherStations() [1].getReportWithMaxTemp().getTemperature(); if(Compare.compare(maxtempl, temp)1) maxtemp1-temp; 30 A4 Ln42, Col 7 Tab Size: 4 UTF-8 LF Java Temperature.java WeatherDatabase.java Compare.java atherStation.java BuildDatabase.java se.javaWeatherReport.java E Untitled-1 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 f* returns the highest temperature on a specified day *that is recorded in a report in the weather stations in this database 8param day is the day to find the nax tenperature an. Note that this night be the special max temperature day that a weather station records *@return the temperature object with the highest recorded Temperature in the data base on the specified day public Temperature getMaxTemperaturefint day Temperature naxtempl = null; Temperature temp: for{ int i=e;1getWeatherStations().length;1++){ if(getWeatherStations( [i].getReportwithMaxTenp().getTime().getDay(day)t iflmaxtemp1nul) naxtempl = getWeatherStations() [1].getReportMithMaxTemp().getTemperature(); else temp getweatherStations()[i].getReportwithMaxTemp().getTenperature(); if(Compare.compare(maxtemp1, tenp)-1) maxtenp1-temp; for(int j 8ijcgetkeatherStations)lil.getReports().length;j iflgetWeatherStations() Iil.getReports )Ijl.getTine).getDay)day maxtenp! = getWeatherStations() [1].getReports()[j].getTemperature(); elset temp = getWeatherStations() [1].getReports() [j].getTemperature(); if(Compare, compare(naxtempi, temp)-=-1)( naxtemp1-temp return maxtenp1; 30 A4 Ln42, Col 7 Tab Size: 4 UTF-8 LF Java Temperature.java , weatherDatabase.java. -Compare.java weatherStationjava-, .BulldDatabase-java weatherReport.java E Untitled-1 : 175 176 / Computes the average temperature (over all weather stations) for the t time period starting at startDay and ending at endDay (inclusive) 178 * @param startDay is the starting day k @param endDay is the ending endDay 180 181 182 @return the average tenperature of all temperature reports for the time period startDay to endDay inclusive) taken from all weather stations in this weather database public double averageTemperaturetint startDay, int endDay)H 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 280 201 282 203 204 205 286 207 208 209 210 211 212 213 214 215 216 217 218 219 220 Temperature temp; int count-; double sum0 forlint i startDay ic endDay:i++H for(int j-8jsgetkeatherStations().length+ if (getweatherStations) [j].getReportwithMaxTemp).getTine().getDay)i) temp = getWeatherStations() [j] .getReportwithMaxTemp().getTemperature().setScale(Scale. CELSIUS); sumte temp.getTemp(): count1; for(int 2-0;zegetWeatherstations() [1.getReports). length;z++)0 if (getWeatherStations() [j ] . getReports() [2] , getTime() . getDay()=i} { iflgetheatherStations() jl.getReports(Iz].getTenperature).setScale(Scale.CELSIUS) getweatherStations) Ij].getReportwithMaxTemp().getTemp temp = getweatherStations() [j] .getReports() [z].getTemperature.setScale Scale. CELSIUS); sum+ tenp.getTemp); count 1; double average sun/count; return average; 30 A4 Ln42, Col 7 Tab Size: 4 UTF-8 LF Java

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

More Books

Students also viewed these Databases questions