Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Give me some hints on Weather Station plz! public class BuildDatabase( /**Build a small database of weather stations @param args is not used in this
Give me some hints on Weather Station plz!
public class BuildDatabase( /**Build a small database of weather stations @param args is not used in this program public static void main (String[] args){ // sample database WeatherDatabase db = new WeatherDatabase() ; // some WeatherStations WeatherStation [1 stations-new WeatherStation[31 stations t0]new WeatherStation ("YOW-Airport", 1); stations [1] = new Weatherstation ("Downtown", 21) ; stations 21new Weatherstation ("Fallowfield-Railway-station", 3) int [] days = {1,2,2,2,4,7,11,20 , 30,32): double[l temps- (10.0, 11, 12, 10, 9.2, 28.1, 10.5, 20, 23, 24): // populate YOW with some weather reports System.out.println ("Building YOW WeatherStation") for (int 1.0; 1days. Iength ; it :1) { Temperature t - new Temperature (temps [i]) Timestamp time = new Time Stamp (days [1],7, 15ti): WeatherReport wr - new WeatherReport (t, time, stations [0]) system. out.printin(" " + wrtoString() ); stations [01.addReport (wr); // populate Down town weather station daysnew int[1 1,2,4,7; temps = new double[] { 12.1, 12.3, 15.2, 16.0, 17.0): System.out.println ("Building Downtown WeatherStation") for (int ); Kdays.length ; +-1) { Temperature t -new Temperature (temps [i]) Timestamp time-new TimeStamp (days [1], B, i); WeatherReport wr = new WeatherReport (t, time, stations [1]); System.out.println( " "+ wr.tostring) ); stations [1].addReport (wr) // populate Fallowfield days-new intl1,1,1,2,2,2,3,3,3,4,4,4,5,5,6,6,6,6,7,7,7,8,8,8) tempsnew double [1 (45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,-1,-1, 10,10,10,10,20,20,20,25,25,25; System.out.println ("Building Fallowfield WeatherStation") for (int 1r); ldays.Iength; it=1){ Temperature t -new Temperature (temps [i]) Timestamp time- new TimeStamp (days [i1,12, 30+i) WeatherReport wr -new WeatherReport (t, time, stations [21) System.out.println("" +wr.tostring stations [2].addReport (wr) // add stations to database for (int i-0; iStep 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