Airplane Management System
Airplane Management System
SAKTHI R(3122235002105)
MITHUN KARTHICK S(3122235002071)
AIM:
The aim of designing this airport database is to organize and manage
all the essential data related to airplanes, technicians, and testing
activities at an airport. The database will provide a structured way to
store and retrieve information to support maintenance, operations,
and management activities at the airport. The main objectives
include:Airplane Management:Maintain a record of all airplanes,
including their registration numbers and associated model
information.Keep track of the different models of airplanes, with
attributes such as model number, capacity, and weight.Technician
Information:Store detailed information about each technician.
RELATIONAL SCHEMA:
CODE SNIPPETS:
CREATE TABLE Model (
model_number VARCHAR2(20) PRIMARY KEY,
capacity NUMBER NOT NULL,
weight FLOAT NOT NULL
);
-- Airplane table with a foreign key to Model
CREATE TABLE Airplane (
registration_number VARCHAR2(20) PRIMARY KEY,
model_number VARCHAR2(20) NOT NULL,
FOREIGN KEY (model_number) REFERENCES
Model(model_number)
);
-- Technician table
CREATE TABLE Technician (
ssn CHAR(9) PRIMARY KEY,
name VARCHAR2(50) NOT NULL,
address VARCHAR2(100),
phone_number VARCHAR2(15),
salary NUMBER(10, 2)
);
-- Test table
CREATE TABLE Test (
test_number NUMBER PRIMARY KEY,
name VARCHAR2(50) NOT NULL,
max_score NUMBER NOT NULL
);
-- TechnicianExpertise table (linking Technician and Model for
expertise)
CREATE TABLE TechnicianExpertise (
technician_ssn CHAR(9),
model_number VARCHAR2(20),
PRIMARY KEY (technician_ssn, model_number),
FOREIGN KEY (technician_ssn) REFERENCES Technician(ssn),
FOREIGN KEY (model_number) REFERENCES
Model(model_number)
);
CODE IMPLEMENTATIONS:
import tkinter as tk
from tkinter import messagebox, ttk
from PIL import Image, ImageTk
import sqlite3
cursor.execute('''
CREATE TABLE IF NOT EXISTS Airplanes (
reg_number TEXT PRIMARY KEY,
model_number TEXT,
airline TEXT,
FOREIGN KEY (model_number) REFERENCES Models
(model_number)
)
''')
cursor.execute("INSERT OR IGNORE INTO Airplanes VALUES
('N12345', 'A320', 'AirwaysX')")
cursor.execute("INSERT OR IGNORE INTO Airplanes VALUES
('N67890', 'B737', 'AirwaysY')")
cursor.execute("INSERT OR IGNORE INTO Models VALUES ('A320',
180, 73500)")
cursor.execute("INSERT OR IGNORE INTO Models VALUES ('B737',
189, 79015)")
cursor.execute("INSERT OR IGNORE INTO Models VALUES ('A380',
853, 1235000)")
conn.commit()
conn.close()
# Initialize database
connect_db()
def show_splash_screen(self):
"""Display the splash screen with a Start button."""
self.clear_window()
# Window dimensions
window_width = 800
window_height = 600
# Airplane button
airplane_button = tk.Button(self.root, image=self.airplane_img,
command=self.show_airplane_window)
airplane_button.place(x=x_start + button_width +
button_spacing_x, y=y_start, width=button_width,
height=button_height)
# Technician button
technician_button = tk.Button(self.root,
image=self.technician_img,
command=self.show_technician_window)
technician_button.place(x=x_start, y=y_start + button_height +
button_spacing_y, width=button_width, height=button_height)
# Test button
test_button = tk.Button(self.root, image=self.test_img,
command=self.show_test_window)
test_button.place(x=x_start + button_width + button_spacing_x,
y=y_start + button_height + button_spacing_y, width=button_width,
height=button_height)
def show_model_window(self):
"""Display the Models section with CRUD functionality."""
self.clear_window()
tk.Label(self.root, text="Models", font=("Arial",
24)).pack(pady=10)
# Back button
back_button = tk.Button(self.root, text="Back",
command=self.show_main_menu)
back_button.pack(pady=10)
def load_models(self):
"""Load model records into the Treeview."""
for i in self.model_tree.get_children():
self.model_tree.delete(i)
conn = sqlite3.connect('airport.db')
cursor = conn.cursor()
cursor.execute("SELECT * FROM Models")
for row in cursor.fetchall():
self.model_tree.insert("", "end", values=row)
conn.close()
def add_model(self):
"""Add a new model to the database."""
model_number = self.model_number_entry.get()
capacity = self.capacity_entry.get()
weight = self.weight_entry.get()
def update_model(self):
"""Update the selected model in the database."""
selected_item = self.model_tree.selection()
if not selected_item:
messagebox.showwarning("Select Error", "Please select a
model to update.")
return
model_number = self.model_number_entry.get()
capacity = self.capacity_entry.get()
weight = self.weight_entry.get()
def delete_model(self):
"""Delete the selected model from the database."""
selected_item = self.model_tree.selection()
if not selected_item:
messagebox.showwarning("Select Error", "Please select a
model to delete.")
return
model_number = self.model_tree.item(selected_item)["values"]
[0]
confirm = messagebox.askyesno("Delete Confirmation", f"Are
you sure you want to delete model {model_number}?")
if confirm:
conn = sqlite3.connect('airport.db')
cursor = conn.cursor()
cursor.execute("DELETE FROM Models WHERE model_number
= ?", (model_number,))
conn.commit()
conn.close()
self.load_models()
messagebox.showinfo("Success", "Model deleted
successfully.")
def show_airplane_window(self):
self.clear_window()
tk.Label(self.root, text="Airplanes", font=("Arial",
24)).pack(pady=10)
conn = sqlite3.connect('airport.db')
cursor = conn.cursor()
cursor.execute("SELECT * FROM Airplanes")
for row in cursor.fetchall():
self.airplane_tree.insert("", "end", values=row)
conn.close()
def add_airplane(self):
"""Add a new airplane to the database."""
reg_number = self.reg_number_entry.get()
model_number = self.model_number_entry_airplane.get()
airline = self.airline_entry.get()
def update_airplane(self):
selected_item = self.airplane_tree.selection()
if not selected_item:
messagebox.showwarning("Select Error", "Please select an
airplane to update.")
return
reg_number = self.reg_number_entry.get()
model_number = self.model_number_entry_airplane.get()
airline = self.airline_entry.get()
def delete_airplane(self):
selected_item = self.airplane_tree.selection()
if not selected_item:
messagebox.showwarning("Select Error", "Please select an
airplane to delete.")
return
reg_number = self.airplane_tree.item(selected_item)["values"]
[0]
confirm = messagebox.askyesno("Delete Confirmation", f"Are
you sure you want to delete airplane {reg_number}?")
if confirm:
conn = sqlite3.connect('airport.db')
cursor = conn.cursor()
cursor.execute("DELETE FROM Airplanes WHERE reg_number
= ?", (reg_number,))
conn.commit()
conn.close()
self.load_airplanes()
messagebox.showinfo("Success", "Airplane deleted
successfully.")
def show_technician_window(self):
"""Display the Technicians section."""
self.clear_window()
tk.Label(self.root, text="Technicians", font=("Arial",
24)).pack(pady=10)
back_button = tk.Button(self.root, text="Back",
command=self.show_main_menu)
back_button.pack(pady=10)
def show_test_window(self):
"""Display the Tests section."""
self.clear_window()
tk.Label(self.root, text="Tests", font=("Arial", 24)).pack(pady=10)
back_button = tk.Button(self.root, text="Back",
command=self.show_main_menu)
back_button.pack(pady=10)
def clear_window(self):
"""Remove all widgets from the current window."""
for widget in self.root.winfo_children():
widget.destroy()
OUTPUT:
RESULT:
The project will deliver an efficient, scalable Airplane Management
System with a user-friendly interface for streamlined inventory
control, order tracking,ensuring secure data management and easy
future enhancements.