Question: Project Name the first main file Flight.java contains the main method. Name the second file Passengers.java and use the supplied text file List.txt. contains the

Project

Name the first main file Flight.java contains the main method.

Name the second file Passengers.java and use the supplied text file List.txt. contains the class your array is based on.

Dont use the try/catch array.

Carry the maximum of 16 passengers

Your project needs to store all the passengers in a 1 dimensional array of objects based on the class you create in the Passengers.java file.

Each object in the array will hold information about one passenger

1)Full Name (stored as one value)

2)Street Address

3)City (as a separate value from the State)

4)State

5)Weight of Passenger

6)Seat# (Seat numbers are 1A, 1B, 2A, 2B, 3A, 3B, 4A, 4B, 5A, 5B, 6A, 6B, 7A, 7B, 8A, 8B)

The program will be responsible for assigning each passenger a seat

The flight is sensitive to weight distribution. You need to have roughly the same weight on each side of the plane. All A seats are on the left of the plane and all B seats are on the right of the plane. The first passenger will be placed in seat 1A, the second passenger will be placed in seat 1B, the third passenger will be placed in the side with the least amount of total weight. This process will be repeated till everyone has been loaded. Make sure you load a maximum of 8 passengers per side.

Passenger input

1)No user input should be added to part 1 of the project. All 16 passengers will be read in from the file List.txt. You will need to modify the text file that I supplied. I supplied you with the 15 passengers. You are responsible for adding one more.

You are not allowed to modify the existing data in the text file.

i.Each value is delimited from the next value with a forward slash including the end of the line. Keep this in mind when adding your one passenger.

Once the data is collected, store it in an object in the array. Place the first passenger (you) at index location 0 and work your way up. This needs to be an object based on the class you create. It cannot be a simple String array.

Once the sub is full, output the full list of passengers from the array to the standard output window. Do this with a for loop. One passenger per line. List only their full name, their city, their state, and their seat assignment. Make sure you do this AFTER the array has been filled with the data. Do not do this as you are reading the data in from the file.

The Passengers Class

The Passengers Class will have the following:

1.Six class variables for the 6 values collected for each object. Note: The full name will go in one class variable, but the city and state will go in separate class variables.

2.A constructor method that assigns all 6 class variables a value.

3.A toString method that will print out just the full name, city, state, and seat for the object.

List.txt:

Mike/Squier/546 Owego Avenue/Maine, Ny/113.4/ Meg/Merwin/123 Appleton Lane/Endicott, Ny/114.8 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!