Question: Write a class called Flight that represents an airline flight. It should contain instance data that represents the airline name, flight number, and the flights
Write a class called Flight that represents an airline flight. It should contain instance data that represents the airline name, flight number, and the flights origin and destination cities. Define the Flight constructor to accept and initialize all instance data. Include getter and setter methods for all instance data. Include a toString method that returns a one-line description of the flight. Create a driver class call PP4_8 , whose main method instantiates and updates several Flight objects.
-After completing this assignment you should have two files PP4_8.java and Flight.java
-You should have a total of 10 methods when you have created the Flight class
1) One constructor method
2) Four setter methods- one for each piece of flight data
3) Four getter methods- one for each piece of flight data
4) One toString method
-The assignment states that you should instantiate (create) and updates several objects. I want you to specifically:
1) Create 7 flight objects.
2) Update the flight number on 2 of the flights after the objects have been created using a setter method that you created.
3) Update the airline name on 1 other flight object
4) Using a System.out.println method in PP4_8, print information about the three objects that you updated
5) Using getter methods, retrieve the flight number and destination of one of the non-modified flights and report to the user via a println statement that it has been delayed. Since this will not call the toString method, you should add an appropriate description with the data.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
