Question
Provided to you is a CSV file called Aircraft.csv which lists the name, year they first appeared and the Country of origin of World War
Provided to you is a CSV file called Aircraft.csv which lists the name, year they first appeared and the Country of origin of World War II aircraft. Use this as a basis for doing the following questions.
Create a Class file Aircraft.java for storing information pertaining to the WWII aircraft. The class should contain fields for the above information and appropriate getters. It should also contain a constructor that talks in an Array of Strings
Create a Java file called AircraftInfo.java and include the following methods in the file:
public static ArrayList
This method should take in the name of the file that stores our aircraft information (Aircraft.cvs) and return an ArrayList of Aircraft as defined above.
public static void writeAircraftObjects(ArrayList
This method will go though and write out all the Aircraft objects in the given linked list to the file whose name is given as the 2nd argument to this method. Write these entries using object serialization.
public static void writeRAFAircraft(ArrayList
This method will write out all Aircraft entries in the given ArrayList to the given file in Random Access format. Note that you are going to have to modify your Aircraft class to achieve this as all Aircraft records should be the same size.
public static Aircraft getRAFRec(String sFile, int nPosition)
This method will return the Aircraft record in the nPosition record in the given file (which is assumed to be in Random Access format). Return null if the nPosition refers to a record that is out of scope for the given file.
//Aircraft.csv
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started