0% found this document useful (0 votes)
4 views37 pages

Airline Management System Report Java

The Airline Management System (AMS) is a Java-based desktop application designed to manage airline operations efficiently and securely, featuring user role authentication and a user-friendly interface. It utilizes SQLite for data management and includes functionalities for flight inventory, passenger records, and ticket booking/cancellation. The project report outlines the system's architecture, design, implementation, and future scope, fulfilling the requirements for a Bachelor of Technology degree in Computer Science and Engineering (Data Science).
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views37 pages

Airline Management System Report Java

The Airline Management System (AMS) is a Java-based desktop application designed to manage airline operations efficiently and securely, featuring user role authentication and a user-friendly interface. It utilizes SQLite for data management and includes functionalities for flight inventory, passenger records, and ticket booking/cancellation. The project report outlines the system's architecture, design, implementation, and future scope, fulfilling the requirements for a Bachelor of Technology degree in Computer Science and Engineering (Data Science).
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AIRLINE MANAGEMENT SYSTEM

A Project Report
Submitted By

SUROOR MUHAMMED P P (CEN24CD034)


SHAZA FATHIMA (CEN24CD032)
SREEHARI MANOJ (CEN24CD034)

SHAFNA P P (CEN24CD030)

SHAIMA ISMAIL (CEN24CD031)


AKASH T V (CEN24CD005)
To

the A P J Abdul Kalam Technological University

in partial fulfillment of the requirements for the award of the Degree

of

Bachelor of Technology

In

Computer Science and Engineering(Data Science)

DEPT. OF COMPUTER SCIENCE & ENGINEERING

COLLEGE OF ENGINEERING AND TECHNOLOGY

PAYYANUR

i
DECLARATION
We undersigned, hereby declare that the project report AIRLINE MANAGEMENT SYSTEM submitted in
partial fulfillment of the requirements for the award of the degree of Bachelor of Technology of APJ
Abdul Kalam Technological University, Kerala, is a bonafide work conducted by us under the supervision
of Shajina Sreedeep, Assistant Professor, Department of Computer Science and Engineering(Data
Science), College of Engineering and Technology, Payyanur .This submission represents our ideas in our
own words, and where the ideas or words of others have been included, we have adequately and
accurately cited and referenced the original sources. We also declare that we have adhered to the ethics
of academic honesty and integrity and have not mis-represented or fabricated any data, idea, fact, or
source in our submission. We understand that any violation of the above will lead to disciplinary action
by the institute and/or the University and may also result in penal action from the original sources if
proper citation or permission has not been [Link], we confirm that this report has not
pre-viously been submitted as the basis for any degree, diploma, or similar title at any other University

SUROOR MUHAMMED P P

SHAZA FATHIMA

Payyannur SREEHARI MANOJ

24/10/2025 SHAFNA P P

SHAIMA ISMAIL
AKASH T V

ii
DEPT. OF COMPUTER SCIENCE & ENGINEERING

DATA SCIENCE

COLLEGE OF ENGINEERING AND TECHNOLOGY

PAYYANUR

2024 – 2025

CERTIFICATE

This is to certify that the report entitled A I R L I N E M A N A G E M E N T


S Y S T E M submitted by S u r o o r M u h a m m e d P P , Shaza Fathima,
Sreehari Manoj, Shafna P P, Shaima Ismail, Akash T V, to the APJ Abdul
Kalam Technological University in partial fulfillment of the [Link] degree in Computer
Science & Engineering(Data Science) is a bonafide record of the project work carried out
by him/her under my/our guidance and supervision. This report in any form has not been
submitted to any other University or Institute for any purpose.

Project Guide Head of the Department

Shajina Sreedeep Bindu N V


Assistant Professor Assistant Professor

Dept. of Computer Science & Engineering Dept. of Computer Science & Engineering

and Technology(Data Science) College of Engineering and Technology

Payyanur (Data Science) Payyanur

Project Coordinator

Shajina Sreedeep

Assistant Professor

Dept. of Computer Science &


Engineering and Technology(Data
Science) Payyanur
iii
ACKNOWLEDGEMENT
We take this opportunity to express our deep sense of gratitude and sincere thanks to all
who helped me to complete the work successfully. Our first and foremost thanks goes
to God Almighty who showered in immense blessings on my effort.

We wish to express our sincere thanks to [Link] Dr. A Pasupathy, Principal


College of Engineering and Technology Payyanur, for providing us with all the necessary
facilities and support. We extend our genuine and heartfelt thanks to Bindu N V,
Assistant Professor and Head, Department of Computer Science and
Engineering(Data Science) for having permitted us to undergo this project and for her
valuable suggestions, help and support during the study, analysis, design and
implementation of this project.
We are thankful and profoundly indebted to our Project guide Shajina Sreedeep
Assistant Professor in Department of Computer Science and Engineering(Data
Science) and Project Supervisor <Name>, Assistant Professor in Department of
Computer Science and Engineering(Data Science) for their exemplary guidance,
criticism, monitoring and constant encouragement throughout the course and for showing us
the right way.

SUROOR MUHAMMED P P

SHAZA FATHIMA

SREEHARI MANOJ

SHAFNA P P

SHAIMA ISMAIL

AKASH T V

iv
VISION

(Institution)

To be an institution in moulding students to acquire, demonstrate and articulate value based


skills that will enable them to be a lifelong learners and socially committed professionals.

MISSION

(Institution)

College of Engineering and Technology is committed to achieve the


vision by:

1. Imparting effective outcome based education.


2. Developing training skills to face the current and future challenges.
3. Acquiring knowledge to solve societal problems.

4. Strengthening relationship with all stakeholde

v
ABSTRACT

The Airline Management System (AMS) is a desktop application developed in Java utilizing the Swing
toolkit for the Graphical User Interface (GUI) and SQLite as the embedded relational database. The core
objective is to create an efficient, secure, and user-friendly platform for managing airline operations. The
system employs a robust authentication module that uses SHA-256 hashing for password security,
separating access into Admin and User roles. The Admin dashboard facilitates the management of flight
inventory, passenger records, and viewing all bookings. The User dashboard is centered on booking and
cancellation functionalities, which rely on the BookingManager and CancelTicket classes to ensure real-
time seat availability updates. The AMS successfully streamlines ticketing and record-keeping,
enhancing the operational efficiency of the airline system.

vi
Table of Contents

ABSTRACT vi
1 INTRODUCTION 1
2 SYSTEM DESIGN 2

2.1 ARCHITECTURE …………………………………………………………………………………………. 3


2.2 WORKING ……………………………………………………………………………………………….. 3

2.3 DATA FLOW DIAGRAM…………………………………………………………………………………. 4

3 TOOLS 5

3.0.1 INTEGRATED DEVELOPMENT ENVIRONMENT……….............…………….. 5

3.0.2 PROGRAMMING LANGUAGE AND PLATFORM……………………….....… 5

3.0.3 DATABASE MANAGEMENY SYSTEM AND CONNECTORS……………….. 5

3.0.4 USER INTERFACE TOOLKIT…………………………………………………………… 5

4 SYSTEM SPECIFICATIONS 6
5.0.1 HARDWARE REQUIREMENTS:………………………………………………………… 6

5.0.2 SOFTWARE REQUIREMENTS:………………………………………………………… 6

5.0.3 FRAMEWORKS AND LIBRARIES……………………………………………………… 6

5 IMPLEMENTATION 8

3.1 LOGINPAGE…………................…………………………………………………………. 8

3.2 USERDASHBOARD………………………………………………………………………….. 9

3.3 CANCEL TICKET………………………………………………………………………………… 9

vii
3.4 FLIGHT BOOKING………………………………………………………………………………….. 10

3.5 ADMIN DASHBOARD…………………………………………………………………………… 10

3.6 PASSENGER MANAGING…………………………………………………………………………………………. 11


3.7 VIEW BOOKING……………………………………………………………………………………… 11

3.8 MANAGE FLIGHTS…………………………………………………………………………………. 12

6 IMPLEMENTATION CODE 13

3.9 DBCONNECTION…………………………………………………………………………………… 13

3.10 PASSWORD HASHING…………….…………………………………………………………. 16

3.11 SEAT AVAILABILITY……………………………………………………………………………. 17

3.12 BOOKING TICKET………………………………………………………………………………….. 18

3.13 CANCEL TICKET………………………………………………………………………………… 20

3.14 [Link]………………………………………………………………………………………. 22

3.15 [Link]………………………………………………………………………. 22

7 FUTURE SCOPE 27
8 CONCLUSION 28

viii
LIST OF FIGURES
3.1 ARCHITECTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2 DFD LEVEL 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3 LOGINPAGE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.4 USER DASHBOARD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.5 CANCEL TICKET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20


3.6 FLIGHT BOOKING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.7 ADMIN DASHBOARD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.8 VIEW BOOKING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.9 MANAGE FLIGHTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

ix
INTRODUCTION
Background The rapid digitalization of services necessitates highly effective management
systems in the travel and tourism sector. Airline operations, characterized by high data
volume and time-sensitive transactions, require a dependable automated solution. This project
addresses the inherent need for a streamlined system that can manage core operations—flight
details, passenger information, and ticket transactions—within a single, integrated platform.

Problem Statement Manual or inefficient legacy systems in airline management are prone to
errors, lead to overbooking, and create significant security vulnerabilities. The challenge is to
develop a modular application that guarantees data integrity during concurrent booking and
cancellation operations and ensures secure user authentication while providing a clear, role-
based operational interface.

Objectives

To develop a cross-platform desktop application using Java Swing for a responsive user
experience.

To implement a role-based access control system secured by SHA-256 password hashing.

To manage the central data store using a lightweight and robust databasesolution,SQLite,via
JDBC.

To implement core business logic within the [Link] and [Link]


classes to ensure that seat availability is atomically updated across the system.

1
SYSTEM DESIGN

2.1 ARCHITECTURE The Airline Management System employs a Two-Tier (Client-Server)


architecture, typical for desktop applications utilizing an embedded database:

Presentation Tier (Client): The user interface is built using Java Swing classes (LoginGUI,
AdminDashboard, UserDashboard).

Business/Data Tier (Client/Embedded): The application logic is handled by manager classes


(BookingManager, FlightManager) which communicate directly with the SQLite database
file (airline_system.db) via the JDBC bridge managed by the DBConnection class.

2.2 WORKING The system initiation begins with [Link], which first calls
[Link]() to create the necessary tables and populate initial
credentials/flights. The LoginGUI is then displayed. Upon login, the
[Link]() method verifies the username and the SHA-256 hashed
password against the users table. The subsequent dashboard (AdminDashboard or
UserDashboard) is loaded based on the verified role.

2.3 DATABASE SCHEMA The system relies on four interconnected tables to maintain data
integrity: | Table Name | Key Columns | Relationships | | :--- | :--- | :--- | | users | id, username,
password (TEXT-Hashed), role | (None) | | passengers | passenger_id (PK), name, email,
phone | One-to-Many relationship with bookings | | flights | flight_id (PK), flight_name,
source, destination, available_seats | One-to-Many relationship with bookings | | bookings |
booking_id (PK), flight_id (FK), passenger_id (FK), seat_number, booking_date | Many-to-
One with flights and passengers |

2.4 DATA FLOW DIAGRAM (DFD)

Data Flow Diagram Level 0 (Context Diagram): The central process, Airline Management
System, interacts with two external entities: the Administrator (input: Flight/Record
Management, output: System Reports) and the User (input: Credentials/Booking
Requests/Cancellation, output: Ticket Status/Available Flights).

Data Flow Diagram Level 1 (Top Level):

1. Authentication: Verifies credentials against the User Database.


2. Flight Management: CRUD operations on the Flight Database (Admin
only).
3. Booking/Cancellation: Updates the Booking Database and modifies the
available_seats in the Flight Database (User).

2
SYSTEM ARCHITECTURE

3
DATA FLOW DIAGRAM

4
TOOLS
3.1 Integrated Development Environment (IDE)

Visual Studio Code (VS Code): VS Code was the primary development environment. It
provided a lightweight yet powerful platform for writing, debugging, and managing the Java
source code. Enhanced with relevant extensions (e.g., Java Extension Pack), it offered
features like intelligent code completion (IntelliSense), syntax highlighting, integrated
terminal, and debugging capabilities, streamlining the development workflow.

3.2 Programming Language and Platform

Java Development Kit (JDK): The JDK (specifically version 17 or higher) was essential,
providing the Java compiler, Java Runtime Environment (JRE), and a vast set of APIs. This
allowed for the development of platform-independent Java applications, including the Swing-
based GUI.

3.3 Database Management Systems and Connectors

SQLite: This lightweight, embedded relational database system was initially used for its
simplicity and single-file database structure (airline_system.db). It's ideal for prototyping and
local data storage, and interacts via the SQLite JDBC Driver.

MySQL Server: For a more robust, scalable, and server-based database solution, MySQL
Server was chosen as the primary backend database management system. It provides
powerful data management capabilities, transactional support, and is widely used in
enterprise applications.

MySQL Connector/J: This is the specific JDBC driver that enables Java applications to
connect to and interact with a MySQL Server database. It translates Java API calls into
MySQL-specific database commands, allowing the application to execute SQL queries,
manage tables, and retrieve data from the MySQL database.

3.4 User Interface Toolkit

Java Swing: A part of the Java Foundation Classes (JFC), Swing was the primary toolkit used
for constructing the graphical user interface. It provides a rich set of platform-independent
GUI components (e.g., JFrame, JTabbedPane, JButton, JTable) that were utilized to build the
LoginGUI, AdminDashboard, and UserDashboard, ensuring a responsive and interactive user
experience.

5
SYSTEM SPECIFICATIONS

4.1 HARDWARE REQUIREMENTS

 Processor: Intel Core i3 (7th Gen) or equivalent.


 Random Access Memory (RAM): 4 GB minimum.
 Storage: 500 MB free Hard Disk Space (for the OS, JDK, and application file
storage).

4.2 SOFTWARE REQUIREMENTS

Operating System: Windows 10/11, Ubuntu 20.04+, or macOS.

Development Environment: Java Development Kit (JDK) 17 or higher.

Database Driver: SQLite JDBC Driver.

IDE: IntelliJ IDEA or Eclipse.

4.3 FRAMEWORKS AND LIBERIES

Library/Component Full Name Usage and Functionality

GUI Framework. This is the primary toolkit


used for creating the entire graphical user
Part of the Java
interface, including windows (JFrame),
Java Swing Foundation
dashboards ([Link],
Classes (JFC)
[Link]), tabbed panels
(JTabbedPane), buttons, and tables (JTable).

Provides foundational GUI components and


graphics capabilities, such as event handling
Abstract Window
AWT (ActionListener) and layout managers
Toolkit
(BorderLayout, GridLayout), used across all
GUI classes.

6
Library/Component Full Name Usage and Functionality

API for Database Interaction. The standard


Java API used by [Link] to
Java Database connect to and communicate with the
JDBC
Connectivity SQLite database. It provides the classes
(Connection, Statement, ResultSet)
necessary to execute SQL queries.

Database Driver. This external JAR file is


the specific implementation of the JDBC API
SQLite JDBC Driver [Link] that allows the Java application to interpret
and manage the SQLite database file
(airline_system.db).

Security. Specifically, the MessageDigest


class is used in [Link] to
[Link] Core Java Library implement the SHA-256 cryptographic hash
algorithm, ensuring that user passwords are
never stored in plaintext.

7
IMPLEMENTATION

LOGIN PAGE

8
USER DASHBOARD

CANCEL TICKET

9
FLIGHT BOOKING

ADMIN DASHBOARD

10
PASSENGER MANAGING

VIEW BOOKING

11
MANAGE FLIGHTS

12
IMPLEMENTATION CODE

Database Connection and Security Initialization ([Link])

The DBConnection class is central to the application, managing the SQLite database
connection and implementing the security mechanism for user authentication.

A. Database Initialization and Default Data Population: This method ensures that the
necessary tables (users, flights, passengers, bookings) exist on application startup. It also
populates initial admin and user accounts with securely hashed passwords, and some default
flight data.

CODE

// Snippet from [Link]

public static void initializeDatabase() {

try (Connection conn = connect()) {

if (conn != null) {

Statement stmt = [Link]();

// Create users table

[Link]("CREATE TABLE IF NOT EXISTS users (" +

"id INTEGER PRIMARY KEY AUTOINCREMENT," +

"username TEXT NOT NULL UNIQUE," +

"password TEXT NOT NULL," +

"role TEXT NOT NULL)"); // 'admin' or 'user'

13
// Create flights table

[Link]("CREATE TABLE IF NOT EXISTS flights (" +

"flight_id INTEGER PRIMARY KEY AUTOINCREMENT," +

"flight_name TEXT NOT NULL," +

"source TEXT NOT NULL," +

"destination TEXT NOT NULL," +

"departure_time TEXT NOT NULL," +

"available_seats INTEGER NOT NULL)");

// Create passengers table

[Link]("CREATE TABLE IF NOT EXISTS passengers (" +

"passenger_id INTEGER PRIMARY KEY AUTOINCREMENT," +

"name TEXT NOT NULL," +

"email TEXT NOT NULL UNIQUE," +

"phone TEXT NOT NULL)");

// Create bookings table

[Link]("CREATE TABLE IF NOT EXISTS bookings (" +

"booking_id INTEGER PRIMARY KEY AUTOINCREMENT," +

"flight_id INTEGER NOT NULL," +

"passenger_id INTEGER NOT NULL," +

"seat_number TEXT NOT NULL," +

"booking_date TEXT NOT NULL," +

14
"FOREIGN KEY (flight_id) REFERENCES flights(flight_id)," +

"FOREIGN KEY (passenger_id) REFERENCES passengers(passenger_id))");

// Insert default admin and user if not exists

if (!userExists("admin")) {

insertUser("admin", hashPassword("admin123"), "admin");

if (!userExists("user")) {

insertUser("user", hashPassword("user123"), "user");

// Insert sample flights if not exists (example)

if (getFlightCount() == 0) {

insertFlight("AirIndia 101", "Delhi", "Mumbai", "08:00", 100);

insertFlight("SpiceJet 202", "Mumbai", "Bangalore", "10:30", 50);

insertFlight("Indigo 303", "Chennai", "Kolkata", "12:00", 75);

} catch (SQLException e) {

[Link]([Link]());

15
Password Hashing (SHA-256):

// Snippet from [Link]

public static String hashPassword(String password) {

try {

MessageDigest md = [Link]("SHA-256");

byte[] hashedBytes = [Link]([Link]()); // Hash the password bytes

// Convert the byte array to a hexadecimal string representation

StringBuilder sb = new StringBuilder();

for (byte b : hashedBytes) {

[Link]([Link]("%02x", b)); // Format each byte as two hexadecimal


characters

return [Link](); // Return the SHA-256 hash string

} catch (NoSuchAlgorithmException e) {

// Log the exception (e.g., to a file or console)

[Link]("SHA-256 algorithm not found: " + [Link]());

return null; // Return null or handle more robustly in a production app

16
Seat Availability Update Utility:

// Snippet (common logic from [Link] and [Link])

private void updateSeatAvailability(Connection conn, int flightId, int change) throws


SQLException {

try (PreparedStatement stmt = [Link](

"UPDATE flights SET available_seats = available_seats + ? WHERE flight_id = ?")) {

[Link](1, change); // 'change' is -1 for booking, +1 for cancellation

[Link](2, flightId);

[Link](); // Execute the update query

17
Booking a Ticket ([Link]):

// Snippet from [Link]

public static boolean bookTicket(int flightId, int passengerId, String seatNumber) {

String sqlInsertBooking = "INSERT INTO bookings(flight_id, passenger_id, seat_number,


booking_date) VALUES(?,?,?,?)";

String sqlCheckSeats = "SELECT available_seats FROM flights WHERE flight_id = ?";

try (Connection conn = [Link]()) {

if (conn == null) return false;

// 1. Check if seats are available

try (PreparedStatement checkStmt = [Link](sqlCheckSeats)) {

[Link](1, flightId);

ResultSet rs = [Link]();

if ([Link]()) {

int availableSeats = [Link]("available_seats");

if (availableSeats <= 0) {

[Link](null, "No seats available for this flight.",


"Booking Error", JOptionPane.ERROR_MESSAGE);

return false;

} else {

[Link](null, "Flight not found.", "Booking Error",


JOptionPane.ERROR_MESSAGE);

return false;

18
}

// 2. Insert the booking record

try (PreparedStatement pstmt = [Link](sqlInsertBooking)) {

[Link](1, flightId);

[Link](2, passengerId);

[Link](3, seatNumber);

[Link](4, [Link]().toString()); // Current date

[Link]();

// 3. Decrement available seats for the flight

updateSeatAvailability(conn, flightId, -1); // Decrement by 1

[Link](null, "Ticket booked successfully!", "Success",


JOptionPane.INFORMATION_MESSAGE);

return true;

} catch (SQLException e) {

[Link](null, "Booking failed: " + [Link](), "Error",


JOptionPane.ERROR_MESSAGE);

[Link]([Link]());

return false;

19
}

Cancelling a Ticket ([Link]):


// Snippet from [Link]

public static boolean cancelBooking(int bookingId) {

String sqlGetFlightId = "SELECT flight_id FROM bookings WHERE booking_id = ?";

String sqlDeleteBooking = "DELETE FROM bookings WHERE booking_id = ?";

try (Connection conn = [Link]()) {

if (conn == null) return false;

int flightId = -1;

// 1. Get the flight_id associated with the booking

try (PreparedStatement pstmt = [Link](sqlGetFlightId)) {

[Link](1, bookingId);

ResultSet rs = [Link]();

if ([Link]()) {

flightId = [Link]("flight_id");

} else {

[Link](null, "Booking not found.", "Cancellation Error",


JOptionPane.ERROR_MESSAGE);

return false;

20
// 2. Delete the booking record

try (PreparedStatement pstmt = [Link](sqlDeleteBooking)) {

[Link](1, bookingId);

int affectedRows = [Link]();

if (affectedRows == 0) {

[Link](null, "Booking not found or already cancelled.",


"Cancellation Error", JOptionPane.ERROR_MESSAGE);

return false;

// 3. Increment available seats for the flight

updateSeatAvailability(conn, flightId, 1); // Increment by 1

[Link](null, "Booking cancelled successfully!", "Success",


JOptionPane.INFORMATION_MESSAGE);

return true;

} catch (SQLException e) {

[Link](null, "Cancellation failed: " + [Link](), "Error",


JOptionPane.ERROR_MESSAGE);

[Link]([Link]());

return false;

21
[Link]

import [Link];

public class Main {

public static void main(String[] args) {

// Initialize database

[Link]();

[Link](() -> {

LoginGUI loginGUI = new LoginGUI();

[Link](true);

});

[Link]

import [Link].*;

import [Link];

import [Link];

public class DBConnection {

private static final String URL = "jdbc:sqlite:airline_system.db";

22
static {

try {

[Link]("[Link]");

} catch (ClassNotFoundException e) {

[Link]("SQLite JDBC Driver not found!");

[Link]();

public static Connection getConnection() throws SQLException {

return [Link](URL);

public static void initializeDatabase() {

try (Connection conn = getConnection();

Statement stmt = [Link]()) {

// Create users table

[Link]("CREATE TABLE IF NOT EXISTS users (" +

"id INTEGER PRIMARY KEY AUTOINCREMENT, " +

"username TEXT UNIQUE NOT NULL, " +

"password TEXT NOT NULL, " +

"role TEXT DEFAULT 'user')");

// Create flights table

[Link]("CREATE TABLE IF NOT EXISTS flights (" +

"flight_id INTEGER PRIMARY KEY AUTOINCREMENT, " +

"flight_name TEXT NOT NULL, " +

23
"source TEXT NOT NULL, " +

"destination TEXT NOT NULL, " +

"departure_time TEXT NOT NULL, " +

"available_seats INTEGER NOT NULL)");

// Create passengers table

[Link]("CREATE TABLE IF NOT EXISTS passengers (" +

"passenger_id INTEGER PRIMARY KEY AUTOINCREMENT, " +

"name TEXT NOT NULL, " +

"email TEXT NOT NULL, " +

"phone TEXT NOT NULL)");

// Create bookings table

[Link]("CREATE TABLE IF NOT EXISTS bookings (" +

"booking_id INTEGER PRIMARY KEY AUTOINCREMENT, " +

"flight_id INTEGER NOT NULL, " +

"passenger_id INTEGER NOT NULL, " +

"seat_number TEXT NOT NULL, " +

"booking_date DATETIME DEFAULT CURRENT_TIMESTAMP, " +

"FOREIGN KEY (flight_id) REFERENCES flights(flight_id), " +

"FOREIGN KEY (passenger_id) REFERENCES passengers(passenger_id))");

// Insert sample users

[Link]("INSERT OR IGNORE INTO users (username, password, role) VALUES " +

"('admin', '" + hashPassword("admin123") + "', 'admin'), " +

"('user1', '" + hashPassword("password1") + "', 'user')");

// Insert sample flights

24
[Link]("INSERT OR IGNORE INTO flights (flight_name, source, destination,
departure_time, available_seats) VALUES " +

"('AI-101', 'Delhi', 'Mumbai', '2024-01-15 08:00:00', 150), " +

"('AI-202', 'Mumbai', 'Chennai', '2024-01-15 14:30:00', 120), " +

"('AI-303', 'Bangalore', 'Delhi', '2024-01-16 10:00:00', 100)");

// Insert sample passengers

[Link]("INSERT OR IGNORE INTO passengers (name, email, phone) VALUES " +

"('John Doe', 'john@[Link]', '123-456-7890'), " +

"('Jane Smith', 'jane@[Link]', '987-654-3210')");

} catch (SQLException e) {

[Link]("Database initialization error:");

[Link]();

private static String hashPassword(String password) {

try {

MessageDigest md = [Link]("SHA-256");

byte[] hashedBytes = [Link]([Link]());

StringBuilder sb = new StringBuilder();

for (byte b : hashedBytes) {

[Link]([Link]("%02x", b));

return [Link]();

} catch (NoSuchAlgorithmException e) {

return password;

25
}

public static String authenticateUser(String username, String password) {

String hashedPassword = hashPassword(password);

String sql = "SELECT role FROM users WHERE username = ? AND password = ?";

try (Connection conn = getConnection();

PreparedStatement stmt = [Link](sql)) {

[Link](1, username);

[Link](2, hashedPassword);

try (ResultSet rs = [Link]()) {

return [Link]() ? [Link]("role") : null;

} catch (SQLException e) {

[Link]("Authentication error: " + [Link]());

return null;

26
FUTURE SCOPE
To transition the system from a prototype to a production-ready application, the following
enhancements are proposed:

Advanced Flight Management: Implement dedicated CRUD (Create, Read, Update, Delete)
forms in the AdminDashboard to allow the Admin to add new flights, modify existing
schedules, or delete cancelled routes without direct database intervention.

Graphical Seat Selection: Replace the text field for Seat Number with a visual, interactive
seating chart (grid layout) that reflects booked and available seats in real-time.

Reporting Module: Integrate a module to generate analytical reports, such as revenue reports,
passenger demographics, and flight load factors.

Web Integration: Migrate the system to a web framework (e.g., Spring Boot) and integrate a
secure payment gateway API (e.g., Stripe or Razorpay) to handle transaction fees.

27
CONCLUSION
The Airline Management System successfully achieves its primary objectives by providing a
robust and secure platform for managing airline operations. By leveraging Java Swing for a
clear GUI and SQLite for efficient data storage, the system ensures data integrity during critical
operations like booking and cancellation through synchronized database updates. The
implementation of SHA-256 hashing establishes a foundation of trust and security for user
data. The modular design, utilizing dedicated manager classes, makes the system
maintainable and scalable for future

28

You might also like