Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You don\'t have to do the whole thing!!! I just need a little push. I start gett

ID: 3717976 • Letter: Y

Question

You don't have to do the whole thing!!! I just need a little push. I start getting lost at #5 because I am confused where exactly I'm prompting the user (which class/method?), where to put the for loop, and how to properly use it with the constructor mentioned after #17.

In general, you be creating a program that will contain information about airline flights. Information for each flight will consist of the airline name, city origin of flight, city destination of flight, and flight number. You will be using two separate files to do this. The first will be called FlightTester and will contain the main method. The second will be called Flight and will contain your instance fields and methods (but no main method).
FlightTester class (this will have the main method)
1. Import appropriately so that you have access to JOptionPane and the Random classes
2. Declare a constant of size 3 (call it NUM) that will be used to declare the size of an array that will hold information about airline flights. This must be declared within the main method
3. Declare an array of size NUM that will be of type Flight (described below). This must be declared within the main method
4. Declare any other variables that you will need in this program. These must be declared within the main method
5. Prompt the user to enter information about an airline. Use the JOptionPane to do this. Insert this information about this airline into an element of the array that will hold your airline information (i.e. use the constructor to accomplish this). You must do this NUM times so you should use a for loop
6. Build a string that contains the following header string:
“(AIRLINE, ORIGIN, DESTINATION, FLIGHT NUMBER) ”
7. Go through each element of the array and build upon this header string information about each flight (i.e. use the toString method to do this-this method is described below). You should use a for loop to do this
8. Using the JOptionPane, display the string that you just built above
9. Prompt and read in information about a new flight. You should use the JOptionPane to do this and you may do this within the main method
10. Generate a random number between 0 and NUM – 1
11. Display using the JOptionPane which airline flight (i.e. the random number that was generated) will be changed
12. Using the four mutator methods in the Flight class (described below) change the appropriate airline flight information. All four mutator methods must be used to accomplish this
13. Build a string that contains the following header string:
“(AIRLINE, ORIGIN, DESTINATION, FLIGHT NUMBER) ”. Using the four accessor methods in the Flight class (described below) build upon this string all the new information about this airline flight that was just modified. All four accessor methods must be used to accomplish this
14. Using the JOptionPane, display the string that you just built above
15. To confirm your changes to this airline flight, repeat steps 6 through 8 from above
16. Display “This program was written by <your name>”. In this window also have (on a separate line) the string “End of program.” Finally, in this same window have a title in the upper left-hand corner that says “Goodbye”. Do this using a JOptionPane.
17. Appropriate comments must be used in this program where applicable.
Flight class
You must have four instance fields in this class. Three for holding the airline name, city origin, and city destination. The fourth will be for the flight number (an integer). Remember that these instance fields must have the access specifier of private.
Constructor:
• Flight(String inAirline, String inOrigin,
String inDestination,
int inFlightNumber)
will assign the appropriate instance fields these incoming parameters
Here are the methods that your program must use in your program:
Accessor methods (four of them) with the access specifier of public:
• String getAirline()
no parameters are received; will return the airline name
• String getOrigin()
no parameters are received; will return the name of the origin city for the flight
• String getDestination()
no parameters are received; will return the name of the destination city for the flight
• int getFlightNumber()
no parameters are received; will return the flight number of this flight
Mutator methods (four of them) with the access specifier of public:
• void setAirline(String inAirline)
will receive one String parameter; will modify the appropriate instance field; nothing will be returned
• void setOrigin(String inOrigin)
will receive one String parameter; will modify the appropriate instance field; nothing will be returned
• void setDestination(String inDestination)
will receive one String parameter; will modify the appropriate instance field; nothing will be returned
• void setFlightNumber(int inFlightNumber)
will receive one integer parameter; will modify the appropriate instance field; nothing will be returned
• String toString()
no parameters are received; will return a string that contains the airline name, city origin, destination city, and the flight number

Explanation / Answer

Keep the process simple.

Doing this will help you write clean code.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote