Airline Reservation System Using Java - 20240317 - 093045 - 0000
Airline Reservation System Using Java - 20240317 - 093045 - 0000
Java
Introduction:
In this project, we’ll show you how to create an Airline reservation system using java. This is a
command-line user interface-based airline reservation system that allows you to check seat
availability and reserve a seat if it is available. The system is designed with a switch case that
gives you three options: view available seats, and reserve a seat. So, get a cup of coffee and
use the airline reservation system.
Explanation:
This Command-Line User Interface (CLI)-based Airline Reservation System provides a simple
and easy way for checking seat availability and reserving a seat if it is available. The system
includes a simple command line interface with a switch case for executing viewing available
seats and reserving a seat.
Switch Case, while loop, and Scanner class are used to build this system. The system will first
present the user with the available options. View available seats, book a seat, and EXIT is
available as a choice. The user must choose a useful option. The operation will be carried out
as per the input choice. The seats are stored in array seats, where 0 indicates an available
seat and 1 represents a reserved seat.
Source Code
//importing required packages for program
import java.util.Scanner;
//reating class
//creating main
while (true) {
System.out.println("3. Exit");
switch (choice) {
displaySeats();
break;
reserveSeat();
break;
case 3:
System.exit(0);
System.out.println("Seats:");
} //end of displayseats()
//if checks if the seat is avaliable or not and if the the seat is avaliable it reserves the seat
else the seat will be not reserved
if (seats[seat] == 0) {
seats[seat] = 1;
} else {
}//end of class
I hope this will be helpful for you, if you have reached here then do not forget to join us.