CODEPROJECT
CODEPROJECT
connector
if choice == 1:
luggage_type = input("Enter luggage type: ")
weight = int(input("Enter weight: "))
mycursor.execute("INSERT INTO luggage (luggage_type, weight) VALUES (%s, %s)",
(luggage_type, weight))
print("Luggage added successfully!")
elif choice == 2:
luggage_id = int(input("Enter luggage ID: "))
mycursor.execute("DELETE FROM luggage WHERE luggage_id = %s", (luggage_id,))
print("Luggage deleted successfully!")
else:
print("Invalid choice.")
obj.commit()
if choice == 1:
cust_name = input("Enter passenger name: ")
cont_no = int(input("Enter passenger contact number: "))
mycursor.execute("INSERT INTO customer_details (cust_name, cont_no) VALUES (%s,
%s)", (cust_name, cont_no))
print("Passenger added successfully!")
elif choice == 2:
cust_id = int(input("Enter passenger ID: "))
cust_name = input("Enter new passenger name: ")
cont_no = int(input("Enter new passenger contact number: "))
mycursor.execute("UPDATE customer_details SET cust_name = %s, cont_no = %s
WHERE cust_id = %s",
(cust_name, cont_no, cust_id))
print("Passenger updated successfully!")
elif choice == 3:
cust_id = int(input("Enter passenger ID: "))
mycursor.execute("DELETE FROM customer_details WHERE cust_id = %s", (cust_id,))
print("Passenger deleted successfully!")
elif choice == 4:
mycursor.execute("SELECT * FROM customer_details")
passengers = mycursor.fetchall()
print("Passenger Records:")
for passenger in passengers:
print(f"ID: {passenger[0]}, Name: {passenger[1]}, Contact: {passenger[2]}")
else:
print("Invalid choice.")
obj.commit()
if choice == 1:
food_name = input("Enter food name: ")
food_price = int(input("Enter food price: "))
mycursor.execute("INSERT INTO food_items (food_name, price) VALUES (%s, %s)",
(food_name, food_price))
print("Food item added successfully!")
elif choice == 2:
food_id = int(input("Enter food ID: "))
new_price = int(input("Enter new price: "))
mycursor.execute("UPDATE food_items SET price = %s WHERE food_id = %s",
(new_price, food_id))
print("Food price updated successfully!")
elif choice == 3:
food_id = int(input("Enter food ID: "))
mycursor.execute("DELETE FROM food_items WHERE food_id = %s", (food_id,))
print("Food item deleted successfully!")
else:
print("Invalid choice.")
obj.commit()
# Book a ticket
def ticket_booking():
cust_name = input("Enter your name: ")
contact_no = int(input("Enter your contact number: "))
flight_id = int(input("Enter flight ID: "))
classtype = input("Enter class type (Business/Middle/Economic): ")
mycursor.execute("""
INSERT INTO booking_details (cust_id, flight_id, classtype, price, date_of_booking)
VALUES (%s, %s, %s, %s, CURDATE())
""", (customer_id, flight_id, classtype, price))
print("Ticket booked successfully!")
obj.commit()
if choice == 1:
flight_available()
elif choice == 2:
food_items()
elif choice == 3:
ticket_booking()
elif choice == 4:
break
else:
print("Invalid choice.")
# Admin menu
def admin():
password = input("Enter admin password: ")
if password == "mukundan":
while True:
print("\n1. Manage Luggage")
print("2. Manage Food")
print("3. Manage Passengers")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
luggage()
elif choice == 2:
food()
elif choice == 3:
passenger()
elif choice == 4:
break
else:
print("Invalid choice.")
else:
print("Incorrect password.")
# Main menu
def main_menu():
while True:
print("\n1. Admin")
print("2. User")
print("3. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
admin()
elif choice == 2:
user()
elif choice == 3:
break
else:
print("Invalid choice.")
if __name__ == "__main__":
main_menu()