Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Flight Exercise Write a class called Flight that contains instance data to represent the airline name, flight number, and the flights origin and destination cities.

Flight Exercise Write a class called Flight that contains instance data to represent the airline name, flight number, and the flights origin and destination cities. Define the flight constructor to accept or initialize all instance data. Include mutator(setter) methods for all instance data, and a toString method that returns the data of the Flight. Create a static variable to keep track of the number of flight objects and a static method to return the number of flights recorded. Create a driver class called FlightTest, whose main method instantiates and updates several Flight objects.image text in transcribed

Please submit the following java programs in a zi pped folder on Canvas: . Flight Exercise: Airline Flight - Flightava (40 pts] o Flight Driver FlightTest.java (20 pts) Remember to include the pledge as a comment in every single file that you submit, followed by your name. "l pledge my Honor that I have not cheated, and will not cheat, on this assignment[insert name here] Not including the pledge will result in a 50% deduction of points for every file that does not have it. And no, putting one pledge as a comment on Canvas does not count. Flight Exercise Write a class called Flight that contains instance data to represent the airline name, flight number, and the flight's origin and destination cities. Define the flight constructor to accept or initialize all instance data. Include mutator setter) methods for all instance data, and a toString method that returns the data of the Flight. Create a static variable to keep track of the number of flight objects and a static method to return the number of flights recorded. Create a driverclass called FlightTest, whose main method instantiates and updates several Flight objects In the Flight class you will need: Private members of the class to store the airline name, flight number, flight origin and destination cities .A static variable to store the number of Flight objects - Two constructors o The first constructor should not accept any values during instantiation (This constructor can initialize the members to an empty string or dash i.e."-or 0 o The second constructor should accept all values for the members during instantiation. e The static variable should be incremented in each version of the constructor .Mutator methods for each member of the class o You will need these to pass values to the second object. .A static method to return the number of flights e This will also serve as the accessor example A toString method to output the information on each flight In the FlightTest driver, you will need; .At least two flight objects . At least one object must be initialized with the constructor that accepts no parameters . At least one object can be "hardcoded" by passing values through the constructor .A Scanner object to get information for one (or more) of the objects . Local variables (as needed) to store information To referene the mutators for one of your objects To reference the static method created in the class A sample of the output is shown below. (Output does not have to be exact you can create any situation that you like -but your code must be able to show successful use of all components of the class and driver programs.) Here is the information for the first part of your flight: American Airlines 1719From: Tampa Bay. To: Las Vegas Please enter the information for the second part of the flight Airline: Delta Origin for connecting flight: Las Vegas Destination for connecting flight: Honolulu Flight Number: 1854 Here is the information for the 2 flights: American Airlines 1719 From: Tampa Bay, To: Las Vegas Delta 1854 From: Las Vegas, To: Honolulu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mysql Examples Explanations Explain Examples

Authors: Harry Baker ,Ray Yao

1st Edition

B0CQK9RN2J, 979-8872176237

More Books

Students also viewed these Databases questions

Question

2. How should this be dealt with by the organisation?

Answered: 1 week ago

Question

explain what is meant by the term fair dismissal

Answered: 1 week ago