22C:21: Computer Science II: Data Structures
Project 1 Solution. Posted 10/31.
- City.java.1.0: This program defines the data
members of the City class, reads from miles.dat,
and stores the data appropriately in the data members. It includes a couple of
extra methods and a little main method to help in testing.
- City.java.2.0: This program extends City.java.1.0
by adding to the City class methods such as
selectEdges, makeGraph, and primitive versions of selectCities
I also added a method called getPopulations that returns the populations of selected cites.
This is enough to do two of the three experiments mentioned in Project 1 handout.
The output from running this program is City.2.0.out.
- City.java.3.0: This program extends City.java.2.0
by increasing the functionality of selectCities and adding a method called getStates that returns
the states that selected cities belong to.
Now all three experiments can be performed. Here is the output: City.3.0.out.Correct
from reading the mileage data correctly and here is the output City.3.0.out.Backwards
from reading it backwards.