SE450: Homework [18/18] ![]() ![]() |
Read Jia Chapters 4 and 5. Pay special attention to the StringTokenizer, the BufferedReader, and the FileReader as you read chapter 4.
Read pages 1-23 of Principles and Patterns by Robert Martin.
Goal: Learn more of the Java APIs. Practice writing more code, debugging, and using multiple source files. Develop some base code for further homework assignments. Improve practices from first homework assignment.
Assume that you have a file of flight records. It is a text file in which each line contains a single record, and each record consists of the following colon-delimited fields:
Airline Code: Airplane Type: Flight Number : Departing Airport : Arriving Airport: Time
A sample line is as follows:
ASA:B73Q:144:ORD:SFA:13
Assume that the time is just a whole hour in 24HH format, as an integer. All other records are strings
Write a Java application that will read in a data file from a command line argument and do the following:
Implement the solution in at least two source files, one called
se450.studentid.hw2.Main
, one called
se450.studentid.hw2.Airline
, and one called
se450.studentid.hw2.Flight
. Replace studentid
with your DePaul id.
Choose a good container for the flights as you work with them in your code, and use an Iterator when you have to traverse the collection of flights.
The Flight class should contain a reference to the Airline, and store the airport codes and airplane types as Strings. The time should be stored as an Integer.
Override toString
to provide a meaningful String
representation of the flight.
The program should take one argument, the filename of data, and
provide the output for parts (a), (b), and (c) all at once. If you are
having trouble with "screen blindness", then redirect the output to a
file for offline reading like this:
java se450.studentid.hw2.Main flights.txt > output.txt
Ask questions on the discussion board!
Submit
a zip
file that contains all necessary .java
files as
well as grader.txt
, in the correct package structure,
just as last week.
Don't include any class files
Due next Monday at 5:30 PM.