Welcome to the Plane Management System, a Java-based application for managing the seating and ticketing of a plane. This application allows users to buy and cancel seats, view the seating plan, and search for tickets, among other features.
- Buy a seat: Book a seat and record passenger details.
- Cancel a seat: Cancel a previously booked seat and remove passenger details.
- Find the first available seat: Locate the first available seat in the seating plan.
- Show seating plan: Display the current seating plan with booked and available seats.
- Print tickets information and total sales: View all booked tickets and the total sales.
- Search ticket: Search for a ticket to check its availability and view passenger details.
- Quit: Exit the application.
-
Clone the repository:
git clone https://github.com/your-username/plane-management-system.git
-
Navigate to the project directory:
cd plane-management-system
-
Compile the Java program:
javac w2052049_PlaneManagement.java Ticket.java Person.java
-
Run the program:
java w2052049_PlaneManagement
Once you run the program, you will see a menu
Enter the number corresponding to the option you want to select and follow the on-screen instructions.
When buying a seat, you will be prompted to enter the row letter and seat number. After booking the seat, you will need to provide passenger details (name, surname, and email). The ticket information will be saved, and you will see a confirmation message.
To cancel a seat, you will be prompted to enter the row letter and seat number. If the seat is currently booked, the booking will be canceled, and the ticket information will be removed.
This option will search for the first available seat and display its location.
The seating plan will be displayed, showing 'O' for available seats and 'X' for booked seats.
This option will print the details of all booked tickets and display the total sales amount.
Enter the row letter and seat number to check the availability of a seat and view the passenger details if the seat is booked.
main(String[] args)
: Main method that displays the menu and handles user input.buy_seat()
: Handles seat booking and passenger detail recording.cancel_seat()
: Handles seat cancellation and ticket removal.find_first_available()
: Finds and displays the first available seat.show_seating_plan()
: Displays the current seating plan.print_tickets_info()
: Prints all booked tickets and total sales.search_ticket()
: Searches for a specific ticket and displays its details.delete(char row, int seat)
: Deletes the ticket file for a canceled booking.
Ticket(char row, int seat, int price, Person person, String Name, String surName, String eMail)
: Constructor to initialize ticket details.getRow()
: Returns the row of the ticket.getSeat()
: Returns the seat number of the ticket.getPrice()
: Returns the price of the ticket.getPerson()
: Returns the person associated with the ticket.setRow(char newRow)
: Sets a new row for the ticket.setSeat(int newSeat)
: Sets a new seat number for the ticket.setPerson(Person newPerson)
: Sets a new person for the ticket.printTicketInfo()
: Prints the ticket information.save()
: Saves the ticket information to a file.
Person(String Name, String surName, String eMail)
: Constructor to initialize person details.getName()
: Returns the name of the person.getSurName()
: Returns the surname of the person.getEMail()
: Returns the email of the person.setName(String newName)
: Sets a new name for the person.setSurName(String newSurName)
: Sets a new surname for the person.setEMail(String newEMail)
: Sets a new email for the person.printPersonInfo()
: Prints the person information.
- Java SE Development Kit (JDK)