[CSC 204] Fwd: Re: CSC 204 Program 5

Andrew J. Pounds pounds_aj at mercer.edu
Thu Dec 8 07:07:14 EST 2016




-------- Forwarded Message --------
Subject: 	Re: CSC 204 Program 5
Date: 	Thu, 8 Dec 2016 05:45:49 -0500
From: 	Andrew J. Pounds <pounds_aj at mercer.edu>
Reply-To: 	pounds_aj at mercer.edu
To: 	



On 12/07/2016 10:38 PM, wrote:
> Ok that helps a lot thank you. So let me make sure I understand this. 
> So our stations and state arrays from program 4, we can keep the same 
> but make them arraylists? As in the states arraylist shouldn't have 
> duplicate states. It should have the combined average temp for each 
> state just like program 4? And then the daily arraylist should have 
> all 400,000+ daily readings and the state it goes with? And then we 
> sort that huge arraylist by hottest and coldest and get the state 
> station number and avg state temp based on the hottest and coldest 
> reading?
>
>

Generally you are correct.  Keep the State.java and Station.java objects 
as they are in Program 4, but in your program 5 store the objects in 
ArrayLists.   I STRONGLY recommend adding a third object class, 
Daily.java, that looks a lot like Station.java but that has a stationID 
and a daily average temp as instance variables.   Each time you process 
a line from the Daily.txt file you then crate a new Daily object that 
holds the stationID and temp and then put that object into your ArrayList.

Once you have read all of the lines from the Daily.txt file you should 
have the 400,000+ daily readings stored as objects (with stationID and 
temp) in an ArrayList that you can sort.  When you print out the results 
you can recover the state that goes with the stationID from your 
stations ArrayList (which holds Station objects) and then use the state 
to recover the average temp from the stateData (which holds State 
objects with average yearly temp info) to get the average temp.

All of you -- keep the questions coming so you can knock this out!   We 
will also dedicate most of classtime tomorrow to work on this.


-- 
Andrew J. Pounds, Ph.D.  (pounds_aj at mercer.edu)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
http://faculty.mercer.edu/pounds_aj

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc204/attachments/20161208/e2d88890/attachment-0001.html>


More information about the csc204 mailing list