[CSC 204] Re: Assignment 6 Questions
Andrew J. Pounds
pounds_aj at mercer.edu
Sat Apr 25 07:13:34 EDT 2009
> Dr.Pounds
>
> When we get the file containing the zip codes, do we add them into an
> array list? Does each separate portion (city name, zip code,
> coordinates) each be put into a separate array? Or do we do like how
> we did in lab 14 and create new objects that are based on something we
> build from the ground up? When we have to create this algorithm, is it
> basically a formula?
>
> Thank-you,
>
For the zip code and coordinate data -- its your call how you do that.
Some people like using parallel arrays, some people prefer array lists.
I mean think about it, here are some possible ways to store the data:
1. parallel arrays for zip code, city, state, latitude, longitude, time
zone, and dst observance
2. parallel ArrayLists for each of these
3. a single array made up of zipcoord objects, with each of these
variables stored as an instance variable
4. a sindle ArrayList made up of zipcoord objects
An algorithm is a process by which you solve a particular problem. In a
sense it is a formula, but it is more general than that. You have all
had to come up with "small" algorithms to solve specific small
problems in your former programs -- like how to count syllables in the
Flesch reading index. Thinking about how to plan your flights is just a
bigger version of that. To get you started, sketch a map of the
southern states and the city locations, beside each city write down how
many people have to be picked up. Somewhere else on your sheet of
paper, keep a tally of who is on your plane and where they need to go.
Think through some scenarios of picking people up and dropping them
off. Here is the important thing --- think about what decision
processes you are following in your head to pick people up and drop them
off. Write that decision process down in words as specifically as you
can -- including as many "decisions" as you can. That description is
called an algorithm. Then convert that algorithm to code and test
it. Here is a hint -- the more specific your algorithm is, the easier
it will be to convert it to code.
--
Andrew J. Pounds, Ph.D. (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://theochem.mercer.edu/pipermail/csc204/attachments/20090425/9f318f54/attachment.html
More information about the csc204
mailing list