Question: Java Program HELP!!! Design and code a program to allow passengers to book flights. In order for a passenger to book a flight, he/she must

Java Program HELP!!!

Design and code a program to allow passengers to book flights. In order for a passenger to book a flight, he/she must enter the following:

First name

Last name

From (city of departure)

To (destination city)

Departure date (use Java date class)

Return date (use Java date class)

Choose a seat. Assume a small airplane with seat numberings as follows:

1 A B C D

2 A B C D

3 A B C D

4 A B C D

5 A B C D

6 A B C D

7 A B C D

You will need to define three classes as part of your model:

The Reservation class will have instance variables to store the reservations details including: seat, from, to, departure date, and return date.

The Passenger class will have instance variables to store the passengers first name, last name, and reservation.

The BookingGUI class will contain all the gui components and listeners. In addition, it should have an array of Passengers, a method to add passenger to the passengers array, and a method to list all passengers. The next screen shot shows the way your GUI should look like:

Seat is using JComboBox

After filling all the fields, clicking Book will save the passenger and display a messages indicating that the reservation was successful.

Note the message in the console. It says Sorry seat has been reserved, because seat 2B is reserved by John Smith (look at the previous screen shot).

You can assign seat only to one passenger.

I changed the seat to 1C, which is good. However, there is another error message Invalid date. Look at the departure and return dates!!! Return must come after the departure.

When List Reservations is clicked, it should display all the passengers in the format shown in the console.

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!