This project processes two data files - one containing information about ships and the other containing information about officers - in the Royal Navy in 1894. The ships, with their data, are processed into a linked list. Then the officers and their information are processed into another linked list. Finally each ship in the first linked list is populated with their crew, as specified in the second link list as described. The resulting data structure is a linked list of ships, with each node containing a linked list of officers assigned to that ship in 1894.
This is the format of the ships.dat data file
H.M.Ship Guns/Tons/HP Station --------------- ------------- ------------------ Abyssinia 4/2900/.. Bombay India Achilles 16/9800/4000 Portsmouth
Regarding the ships.dat information:
This is the format of the officers.dat data file
NAMES RANK H.M.Ship --------------------- --------------- -------- A'COURT John Fleet Engineer Himalaya ACLAND William A.Dyke Captain Edgar ADAIR Thomas B.S. First Lieut. Excellent *
Regarding the officers.dat information:
Use appropriate OOP techniques for the project. You will use two source files, ships.dat and officers.dat as provided. You will need to write two classes for your data types: Ship.java and Officer.java. The Ship class needs to include an embedded linked list that will be populated with the officers of that ship.
You will need to write two classes that extend java.util.LinkedList (or your equivalent Linked List base class) to create two linked lists from the data: ShipListFromFile.java and OfficerListFromFile.java. The ShipListFromFile constructor populates its LinkedList from the Ship.java data file. The EasyReader class can simplify getting the data from the ships.dat and officers.dat files.
Your main program, ShipIndex.java should first create the officer and ships lists. Then, using nested iterators, it should put the officers in the OfficerListFromFile linked list into the personnel list in their assigned ships as stored in the ShipListFromFile linked list. Finally, the main program will display all ships, with their personnel, again using iterators appropriately.
Your results for the first three ships should look like this:
Abyssinia: ELDERTON Ferdinand H, Lieut MOYSEY John, Fleet Engineer Achilles: DICKSON David L., Commander McCARTHY John, Staff Engineer Active: ASKHAM Alfred W., Staff Paymaster COKE Charles H., Commander DOUGHERTY John A., Chaplain HARRIS Robert H., Commodore HUGHES Sidney, First Lieut. JOHNSTON Alex. J.J., Staff Surgeon WHITE William H., Fleet Engineer
|Copyright © 2010 by Asylum Computer Services LLC||Return to CS Labs|