0% found this document useful (0 votes)
6 views62 pages

Tours and Travels Management System

The document outlines a project for a Tours and Travels Booking System developed by students at Rockwoods High School for the All India Senior School Certificate Examination 2025-26. It details the project's purpose, scope, required hardware and software, and includes a comprehensive system design with functional requirements, modules, and a database schema. The project aims to streamline tour bookings and management, providing a user-friendly interface for both customers and administrators.

Uploaded by

joshikitty260
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)
6 views62 pages

Tours and Travels Management System

The document outlines a project for a Tours and Travels Booking System developed by students at Rockwoods High School for the All India Senior School Certificate Examination 2025-26. It details the project's purpose, scope, required hardware and software, and includes a comprehensive system design with functional requirements, modules, and a database schema. The project aims to streamline tour bookings and management, providing a user-friendly interface for both customers and administrators.

Uploaded by

joshikitty260
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

Submitted By: _______________________

Class: __________ Stream: _____________

1
CERTIFIED TO BE THE BONAFIDE RECORD OF WORK DONE BY MASTER/MISS

………………………………………………. OF CLASS ………………. IN THE ROCKWOODS HIGH

SCHOOL, UDAIPUR DURING THE YEAR 2025-26.

DATED…………

MR. SHABBIR MODI


P.G.T. IN COMPUTER SCIENCE

MS. ANJALA SHARMA


PRINCIPAL

SUBMITTED FOR ALL INDIAN SENIOR SCHOOL CERTIFICATE EXAMINATION, 2025-26 IN COMPUTER
SCIENCE AT THE ROCKWOODS HIGH SCHOOL, UDAIPUR.

DATED ……………

EXTERNAL EXAMINER
SEAL

2
I hereby declare that this project entitled “
” is the original
work done, written and compiled by me for All India
Senior Certificate Examination in Computer Science at
the Rockwoods High School, Udaipur during the
academic year 2025-2026.

Name:
Class: XII – Sec -
Stream: Science
Signature:
Dated:

3
I EXPRESS MY DEEP GRATITUDE AND APPRECIATION TO THOSE
WHO AGREED TO PARTICIPATE IN THIS PROJECT, FOR THEIR
TIME EXPENDED AND COURAGE IN SHARING THEIR INSIGHTS
WITH A FLEDGING STUDENT. IT IS TO THEM THAT I AM MOST
INDEBTED, AND I CAN ONLY HOPE THAT THE PRODUCTS OF
OUR COLLABORATION BENEFITS EACH ONE AS MUCH AS I
BENEFITED FROM THE PROCESS.

I HAVE BEEN IMMEASURABLY ENRICHED BY WORKING UNDER


THE SUPERVISION OF MR. SHABBIR MODI THE SUBJECT
TEACHER, WHO HAS GREAT LEVEL OF KNOWLEDGE AND WHO
HAS AN ART OF ENCOURAGING CORRECTING AND DIRECTING
ME IN EVERY SITUATION POSSIBLE, WHICH HAS ENABLED ME TO
COMPLETE THE PROJECT.

AT TIMES, MY STUDIES CARRIED OUT A GREAT COST TO THOSE


CLOSEST TO ME. I THANK MY FAMILY AND MY FELLOW
STUDENTS FOR THEIR BEST UNDERSTANDING AND SUPPORT.

I ACKNOWLEDGE TO ALL THE PEOPLE WHO HAVE INVOLVED


AND SUPPORTED ME IN MAKING THIS PROJECT.

4
[Link]. Topic Name Page no. signature

1. SYNOPSIS
Introduction
Objective
Software
Requirement
Overall
Perspective
Special
Requirements
System
Analysis
Modules
Advantages
Disadvantages
2. Source Code
3. Outputs
4. Bibliography
5
Group Members:
Himalaya Raj Singh Solanki (Group Leader)
Niyati Joshi
Lavanya Bithu

6
7
The Tours and Travels Booking System is a software
solution that simplifies the management of tour packages
and bookings. It provides a digital interface for
customers to explore destinations, hotels, and insurance
options, and for administrators to manage the travel
data. This project simulates real-world travel agency
functions such as adding destinations, hotel booking,
optional travel insurance, and cancellation of tours.
1.1 Purpose
 Minimize manual efforts and human errors in

managing tour bookings


 Provide customers with an easy-to-use booking and

information system
 Ensure data is stored securely and systematically

1.2 Scope
 This project supports adding/viewing/removing

destinations, hotels, and insurance policies by admin


 Customers can book, view, and cancel bookings

 Optional travel insurance can be selected during

booking
 Hotel and destination details are linked and

dynamically managed
 Supports multiple travelers per booking

8
1.3 Abbreviations
 TTS: Tours and Travels System

 DBMS: Database Management System

 SQL: Structured Query Language

 Provide a real-time simulation of a travel agency


system
 Allow data entry and modification for admins
 Allow customers to explore and book travel packages
 Store and retrieve customer and booking data
efficiently
 Automate pricing calculations with optional add-ons
(hotels, insurance)

To run this project efficiently, certain software and


hardware components are required.
3.1 Hardware Components
Laptop-
 Manufacturer: ASUSTek COMPUTER INC.
 Model: ASUS VivoBook 16X

9
 Operating system: Windows 11
 Processor: AMD Ryzen 5 5600H with Radeon Graphics
(3.30 GHz)
 Graphics: AMD Raedon™
 System type: 64-bit operating system, x64-based
processor

3.2 Software Components


 Anaconda prompt- it is used to establish the
connectivity. It enables python program to access
MySQL databases using API.

 Microsoft edge- Save time with smart copy.

 Microsoft word- it is a word processing program used


for creating document such as letter, projects, etc.

 MySQL server (5.1) - it is open source RDMS it uses


Structured Query Language (SQL), it is used to store a

10
bulk of data. The relation database organizes the data
into one or more data table. It acts as a backend.

 Anaconda (python software)- python is opensource


software which can be easily downloaded from the
internet, it is high level language and is user friendly
program. It acts as a frontend.

Spyder version (3.7)

4.1 Product Perspective


 Console-based project using Python and MySQL

 Operates in admin and customer modes

 Structured around a modular database schema

11
4.2 Product Functions
 Main Menu Functions:

o Admin Login: Allows the admin to add

Destinations, Hotels, Insurance.


o View Destinations: Allows the user to view the

available Destinations.
o Book a tour: Enables a user to book a trip by

selecting a Destination and entering customer


details.
o View Bookings: Allows the user to view his/her

Bookings.
o Delete Bookings: Allows the user to delete his/her

Bookings.

5.1 Functional Requirements


 Admin Login with predefined credentials

 Add, view, and delete travel data

 Customer input for name, contact, and travel choices

 Optional hotel and insurance integration in booking

5.2 Performance Requirements


 System responds within seconds of inputs

 Multi-user compatible

 Real-time commit to database

12
5.3 Future Enhancements
GUI Interface (Tkinter or Web App)
 Online payment simulation

 PDF Ticket generation

 Destination image gallery

6.1 Establishing Connection


 Connects Python with MySQL using [Link]

 Auto-creates required tables and inserts admin

credentials
6.2 Front End: Python
 Used for logic and user interaction

 Implements all features via menu-driven console

interface
6.3 Back End: MySQL
 Stores all data in structured tables

 Uses relationships (FOREIGN KEY) between

destinations, hotels, insurance, bookings, and travelers

13
7.1 Admin Module
 Login authentication

 Add/View/Delete destinations, hotels, insurance

 View booking-related data indirectly via destination

associations
7.2 Customer Module
 View destination details

 Book a tour with optional selections

 Enter traveler data

 View and cancel existing bookings via phone number

 No manual ledger system


 Organized and searchable bookings
 Expandable to more destinations or users
 Realistic booking features

 Console-based interface only (no GUI)


 No real-time payments
 Limited security features (simple password handling)

14
15
Database: travel_agency
 Tables
 desc admin

 desc destinations

 desc hotels

16
 desc insurance

 desc bookings

 desc travelers

17
18
import [Link]
from [Link] import errors
from datetime import datetime
# ---------------------------
# Database connection
# ---------------------------
try:
mydb = [Link](
host="localhost",
user="root",
passwd="user"
)
except [Link]:
print("ERROR: Unable to connect to MySQL. Make sure MySQL server is running and credentials are
correct.")
raise
mycursor = [Link]()
# ---------------------------
# Create database and use it
# ---------------------------
[Link]("CREATE DATABASE IF NOT EXISTS travel_agency")
[Link]("USE travel_agency")
# ---------------------------
# Create tables (idempotent)
# ---------------------------

# Admins
[Link]('''
CREATE TABLE IF NOT EXISTS admin ( id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE,
password VARCHAR(50)
)
''')

19
# Destinations
[Link]('''
CREATE TABLE IF NOT EXISTS destinations ( id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
description TEXT,
start_place VARCHAR(100),
start_datetime VARCHAR(50),
package_type VARCHAR(50),
nights INT,
tour_days INT,
price_adult DECIMAL(12,2),
price_infant DECIMAL(12,2),
travel_method VARCHAR(200)
)
''')
# Hotels
[Link]('''
CREATE TABLE IF NOT EXISTS hotels ( id INT AUTO_INCREMENT PRIMARY KEY,
destination_id INT,
hotel_name VARCHAR(100),
features TEXT,
type VARCHAR(50),
price_per_day DECIMAL(12,2),
meal_options VARCHAR(100),
FOREIGN KEY (destination_id) REFERENCES destinations(id) ON DELETE CASCADE
)
''')
# Insurance plans (multiple per destination)
[Link]('''
CREATE TABLE IF NOT EXISTS insurance ( id INT AUTO_INCREMENT PRIMARY KEY,
destination_id INT,
name VARCHAR(100),
price DECIMAL(12,2),
coverage_amount DECIMAL(14,2),
FOREIGN KEY (destination_id) REFERENCES destinations(id) ON DELETE CASCADE

20
)
''')
# Customers
[Link]('''
CREATE TABLE IF NOT EXISTS customers ( id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE,
password VARCHAR(50),
phone VARCHAR(20),
email VARCHAR(100)
)
''')
# Bookings (booking_date as TIMESTAMP to avoid default issues)
[Link]('''
CREATE TABLE IF NOT EXISTS bookings ( id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
destination_id INT,
hotel_id INT,
insurance_id INT,
num_adults INT,
num_infants INT,
total_price DECIMAL(14,2),
booking_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE CASCADE,
FOREIGN KEY (destination_id) REFERENCES destinations(id) ON DELETE CASCADE,
FOREIGN KEY (hotel_id) REFERENCES hotels(id) ON DELETE SET NULL,
FOREIGN KEY (insurance_id) REFERENCES insurance(id) ON DELETE SET NULL
)
''')
# Travelers linked to bookings
[Link]('''
CREATE TABLE IF NOT EXISTS travelers ( id INT AUTO_INCREMENT PRIMARY KEY,
booking_id INT,
name VARCHAR(100),
aadhar VARCHAR(30),
FOREIGN KEY (booking_id) REFERENCES bookings(id) ON DELETE CASCADE

21
)
''')
[Link]()
# Insert default admin (if not exists)
[Link]("INSERT IGNORE INTO admin (username, password) VALUES ('admin', 'adminkey')")
[Link]()
# ---------------------------
# Helper / Utility functions
# ---------------------------
def input_int(prompt, allow_blank=False):
"""Read integer from user with validation. If allow_blank True, blank returns None."""
while True:
val = input(prompt).strip()
if allow_blank and val == "":
return None
if [Link]():
return int(val)
print("Please enter a valid number.")
def input_float(prompt, allow_blank=False):
while True:
val = input(prompt).strip()
if allow_blank and val == "":
return None
try:
return float(val)
except ValueError:
print("Please enter a valid number (e.g., 1500 or 1500.50).")

def view_destinations():
[Link]("SELECT id, name, description, start_place, start_datetime, package_type, nights,
tour_days, price_adult, price_infant, travel_method FROM destinations")
rows = [Link]()
if not rows:
print("\nNo destinations available.")
return

22
print("\n===== AVAILABLE DESTINATIONS =====")
for r in rows:
id_, name, desc, start_place, start_dt, pkg, nights, days, p_adult, p_infant, travel = r
infant_text = f"₹{p_infant}" if p_infant and float(p_infant) > 0 else "Not applicable"
print(f"\nID: {id_} | {name}")
print(f" Description : {desc}")
print(f" Start Place : {start_place}")
print(f" Start Date : {start_dt}")
print(f" Package : {pkg} | {nights} nights / {days} days")
print(f" Price (Adult): ₹{p_adult} | Infant: {infant_text}")
print(f" Travel : {travel}")
print("===================================")

def view_hotels(destination_id):
# Validate destination_id numeric
if not str(destination_id).isdigit():
print("Invalid destination id.")
return
[Link]("SELECT id, hotel_name, features, type, price_per_day, meal_options FROM hotels
WHERE destination_id=%s", (destination_id,))
hotels = [Link]()
if not hotels:
print("No hotels found for this destination.")
return
print("\n--- Hotels ---")
for h in hotels:
hid, name, features, rtype, price, meals = h
print(f"Hotel ID: {hid} | {name} | Room: {rtype} | ₹{price}/day | Meals: {meals}")
print(f" Features: {features}")
print("--------------")

def view_insurance_for_destination(destination_id):
if not str(destination_id).isdigit():
print("Invalid destination id.")
return []

23
[Link]("SELECT id, name, price, coverage_amount FROM insurance WHERE
destination_id=%s", (destination_id,))
ins = [Link]()
if not ins:
print("No insurance plans available for this destination.")
return []
print("\n--- Insurance Plans ---")
for i in ins:
iid, name, price, coverage = i
print(f"{iid}. {name} | Price: ₹{price} | Coverage: ₹{coverage}")
print("------------------------")
return ins
# ---------------------------
# Admin functions
# ---------------------------

def admin_menu():
"""Admin control panel for managing destinations, hotels, and insurance."""
while True:
print("\n========== ADMIN MENU ==========")
print("1. Add Destination")
print("2. Add Hotel")
print("3. Add Insurance")
print("4. View Destinations")
print("5. View Hotels")
print("6. View Insurance")
print("7. Remove Destination")
print("8. Remove Hotel")
print("9. Remove Insurance")
print("10. Back to Main Menu")
print("================================")
ch = input("Enter your choice: ").strip()
# --- ADD DESTINATION ---
if ch == '1':
name = input("Destination name: ").strip()

24
desc = input("Description: ").strip()
start_place = input("Starting place: ").strip()
start_dt = input("Start date and time (YYYY-MM-DD HH:MM) or leave blank: ").strip()
package_options = {
"1": "Family",
"2": "Friends",
"3": "Honeymoon",
"4": "Adventure",
"5": "Cultural",
"6": "Religious",
"7": "Solo"
}
print("\nSelect Package Type:")
for key, val in package_options.items():
print(f"{key}. {val}")
pkg_choice = input("Enter choice number: ").strip()
package_type = package_options.get(pkg_choice, "Family")

nights = input_int("Number of nights: ")


days = input_int("Number of days: ")
price_adult = input_float("Price per adult: ")
if package_type in ["Honeymoon", "Solo", "Adventure"]:
price_infant = 0.0
print(f"Infant price not applicable for {package_type} package.")
else:
price_infant = input_float("Price per infant: ")
travel_method = input("Travel method (brief): ").strip()
[Link]('''
INSERT INTO destinations (name, description, start_place, start_datetime, package_type,
nights, tour_days, price_adult, price_infant, travel_method)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
''', (name, desc, start_place, start_dt, package_type, nights, days, price_adult, price_infant,
travel_method))
[Link]()
print("Destination added successfully!")

25
# --- ADD HOTEL ---
elif ch == '2':
view_destinations()
# Validate Destination ID
while True:
dest_id_raw = input("Enter Destination ID to link the hotel: ").strip()
if not dest_id_raw.isdigit():
print("Please enter a numeric Destination ID.")
continue
dest_id = int(dest_id_raw)
[Link]("SELECT id FROM destinations WHERE id=%s", (dest_id,))
if not [Link]():
print("No destination found with that ID. Try again.")
continue
break
hotel_name = input("Hotel name: ").strip()
features = input("Hotel features: ").strip()
while True:
room_options = {
"1": "Suit",
"2": "Deluxe",
"3": "Standard",
"4": "Family",
"5": "Single",
"6": "Double",
"7": "Triple"
}
print("\nSelect Room Type:")
for key, val in room_options.items():
print(f"{key}. {val}")
print("8. Other (custom room type)")
r_choice = input("Enter choice: ").strip()

if r_choice in room_options:
rtype = room_options[r_choice]

26
elif r_choice == "8":
rtype = input("Enter custom room type: ").strip()
else:
print("Invalid choice. Defaulting to 'Standard'.")
rtype = "Standard"
price = input_float(f"Price per day for {rtype}: ")
meals = input("Meal options: ").strip()
[Link]('''
INSERT INTO hotels (destination_id, hotel_name, features, type, price_per_day,
meal_options)
VALUES (%s,%s,%s,%s,%s,%s)
''', (dest_id, hotel_name, features, rtype, price, meals))
[Link]()
print(f"{rtype} room added successfully for hotel '{hotel_name}'!")
more = input("Add another room for this hotel? (yes/no): ").strip().lower()
if more != 'yes':
break
# --- ADD INSURANCE ---
elif ch == '3':
view_destinations()
# Validate Destination ID
while True:
dest_id_raw = input("Enter Destination ID to link insurance: ").strip()
if not dest_id_raw.isdigit():
print("Please enter a numeric Destination ID.")
continue
dest_id = int(dest_id_raw)
[Link]("SELECT id FROM destinations WHERE id=%s", (dest_id,))
if not [Link]():
print("No destination found with that ID. Try again.")
continue
break
while True:
ins_name = input("Insurance name (e.g., Premium Plan): ").strip()
ins_price = input_float("Insurance price: ")

27
ins_coverage = input_float("Coverage amount: ")
[Link]('''
INSERT INTO insurance (destination_id, name, price, coverage_amount)
VALUES (%s,%s,%s,%s)
''', (dest_id, ins_name, ins_price, ins_coverage))
[Link]()
print(f"Insurance '{ins_name}' added for destination ID {dest_id}.")
more = input("Add another insurance plan for this destination? (yes/no): ").strip().lower()
if more != 'yes':
break
# --- VIEW DESTINATIONS ---
elif ch == '4':
view_destinations()
# --- VIEW HOTELS ---
elif ch == '5':
did = input("Enter Destination ID to view hotels: ").strip()
if [Link]():
view_hotels(did)
else:
print("Please enter a numeric ID.")
# --- VIEW INSURANCE ---
elif ch == '6':
did = input("Enter Destination ID to view insurance plans: ").strip()
if [Link]():
view_insurance_for_destination(did)
else:
print("Please enter a numeric ID.")
# --- REMOVE DESTINATION ---
elif ch == '7':
did = input("Enter Destination ID to remove: ").strip()
if [Link]():
[Link]("DELETE FROM destinations WHERE id=%s", (did,))
[Link]()
print("Destination removed successfully!")
else:

28
print("Please enter a numeric ID.")
# --- REMOVE HOTEL ---
elif ch == '8':
hid = input("Enter Hotel ID to remove: ").strip()
if [Link]():
[Link]("DELETE FROM hotels WHERE id=%s", (hid,))
[Link]()
print("Hotel removed successfully!")
else:
print("Please enter a numeric ID.")
# --- REMOVE INSURANCE ---
elif ch == '9':
iid = input("Enter Insurance ID to remove: ").strip()
if [Link]():
[Link]("DELETE FROM insurance WHERE id=%s", (iid,))
[Link]()
print("Insurance removed successfully!")
else:
print("Please enter a numeric ID.")
# --- BACK ---
elif ch == '10':
break
else:
print("Invalid choice. Try again.")
# ---------------------------
# Customer functions
# ---------------------------
def customer_signup():
print("\n--- Create Customer Account ---")
while True:
username = input("Enter username: ").strip()
if username == "":
print("Username cannot be blank.")
continue
password = input("Enter password: ").strip()

29
phone = input("Enter phone number: ").strip()
email = input("Enter email: ").strip()
try:
[Link]("INSERT INTO customers (username, password, phone, email) VALUES
(%s,%s,%s,%s)",
(username, password, phone, email))
[Link]()
print("Account created successfully! You can now log in.")
break
except [Link]:
print("Username already exists. Try a different username.")
def customer_login():
print("\n--- Customer Login ---")
uname = input("Enter username: ").strip()
pwd = input("Enter password: ").strip()
[Link]("SELECT * FROM customers WHERE username=%s AND password=%s", (uname,
pwd))
user = [Link]()
if user:
print(f"Welcome, {user[1]}!")
return user
else:
print("Invalid credentials.")
return None
def book_tour(customer):
print("\n--- Book a Tour ---")
view_destinations()
dest_id_raw = input("Enter Destination ID to book: ").strip()
if not dest_id_raw.isdigit():
print("Invalid Destination ID.")
return
dest_id = int(dest_id_raw)
[Link]("SELECT * FROM destinations WHERE id=%s", (dest_id,))
dest = [Link]()
if not dest:

30
print("That destination does not exist.")
return
# Show hotels for this destination
view_hotels(dest_id)
hotel_id_raw = input("Enter Hotel ID to choose (leave blank to skip): ").strip()
hotel_id = None
hotel_price = 0
if hotel_id_raw != "":
if not hotel_id_raw.isdigit():
print("Invalid Hotel ID.")
return
hotel_id = int(hotel_id_raw)
[Link]("SELECT price_per_day, hotel_name, type FROM hotels WHERE id=%s AND
destination_id=%s", (hotel_id, dest_id))
hotel = [Link]()
if not hotel:
print("Selected hotel not found for this destination.")
return
hotel_price = float(hotel[0])
print(f"Selected hotel: {hotel[1]} | Room: {hotel[2]} | ₹{hotel_price}/day")
# Show insurance options
ins_list = view_insurance_for_destination(dest_id)
selected_insurance_id = None
selected_insurance_price = 0
if ins_list:
print("Choose an insurance by entering its ID from the list, or enter 0 for none.")
while True:
choice_raw = input("Insurance ID (0 for none): ").strip()
if not choice_raw.isdigit():
print("Enter a numeric ID or 0.")
continue
choice = int(choice_raw)
if choice == 0:
break
matches = [x for x in ins_list if x[0] == choice]

31
if not matches:
print("Invalid insurance ID. Choose again.")
continue
selected_insurance_id = matches[0][0]
selected_insurance_price = float(matches[0][2])
print(f"Selected insurance: {matches[0][1]} | Price: ₹{selected_insurance_price} | Coverage:
₹{matches[0][3]}")
break
else:
print("No insurance plans available; continuing without insurance.")

# Travelers count (infant logic)


package_type = dest[5]
print(f"Package type: {package_type}")
num_adults = input_int("Number of adults: ")
num_infants = 0
if package_type not in ["Honeymoon", "Solo", "Adventure"]:
num_infants = input_int("Number of infants: ")
else:
print("Infants not applicable for this package (set to 0).")
# Cost calculation: adult + infant + hotel (per day * tour_days * persons) + insurance (flat)
price_adult = float(dest[8])
price_infant = float(dest[9])
tour_days = int(dest[7]) if dest[7] else 1
hotel_total = 0
if hotel_price:
hotel_total = hotel_price * tour_days * (num_adults + num_infants)
total_price = (num_adults * price_adult) + (num_infants * price_infant) + hotel_total +
selected_insurance_price
print("\n--- Booking Summary ---")
print(f"Destination : {dest[1]} | Package: {package_type}")
if hotel_id:
print(f"Hotel ID : {hotel_id} | Hotel cost (approx): ₹{hotel_total}")
if selected_insurance_id:
[Link]("SELECT name, price, coverage_amount FROM insurance WHERE id=%s",
(selected_insurance_id,))

32
insdet = [Link]()
print(f"Insurance : {insdet[0]} | Price: ₹{insdet[1]} | Coverage: ₹{insdet[2]}")
else:
print("Insurance : None")
print(f"Adults : {num_adults} | Infants: {num_infants}")
print(f"Total Payable: ₹{total_price}")
print("------------------------")
confirm = input("Confirm booking? (yes/no): ").strip().lower()
if confirm != 'yes':
print("Booking aborted.")
return
# Insert booking
[Link]('''
INSERT INTO bookings (customer_id, destination_id, hotel_id, insurance_id, num_adults,
num_infants, total_price, booking_date)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s)
''', (customer[0], dest_id, hotel_id if hotel_id else None, selected_insurance_id, num_adults,
num_infants, total_price, [Link]()))
[Link]()
booking_id = [Link]
# Travelers
print("\nEnter traveler details (Name & Aadhar):")
for i in range(num_adults + num_infants):
tname = input(f"Traveler {i+1} Name: ").strip()
taadhar = input(f"Traveler {i+1} Aadhar: ").strip()
[Link]("INSERT INTO travelers (booking_id, name, aadhar) VALUES (%s,%s,%s)",
(booking_id, tname, taadhar))
[Link]()
print(f"Booking successful! Booking ID: {booking_id} | Total Paid: ₹{total_price}")
def view_bookings(customer):
[Link]('''
SELECT [Link], [Link] as dest_id, [Link], d.package_type, h.hotel_name, [Link], [Link],
i.coverage_amount,
b.num_adults, b.num_infants, b.total_price, b.booking_date
FROM bookings b
JOIN destinations d ON b.destination_id = [Link]

33
LEFT JOIN hotels h ON b.hotel_id = [Link]
LEFT JOIN insurance i ON b.insurance_id = [Link]
WHERE b.customer_id=%s
ORDER BY b.booking_date DESC
''', (customer[0],))
rows = [Link]()
if not rows:
print("\nNo bookings found.")
return
print("\n===== Your Bookings =====")
for r in rows:
(bid, dest_id, dest_name, pkg, hotel_name, ins_name, ins_price, ins_cov, adults, infants, total,
bdate) = r
print(f"\nBooking ID: {bid} | Destination ID: {dest_id} | {dest_name} ({pkg})")
print(f" Hotel: {hotel_name if hotel_name else 'None'}")
if ins_name:
print(f" Insurance: {ins_name} | Price: ₹{ins_price} | Coverage: ₹{ins_cov}")
else:
print(" Insurance: None")
print(f" Travelers: Adults-{adults}, Infants-{infants}")
print(f" Total Paid: ₹{total}")
print(f" Booked On: {bdate}")
print("---------------------------")
def cancel_booking(customer):
# Show bookings first
[Link]('''
SELECT [Link], [Link] as dest_id, [Link], d.package_type, h.hotel_name, [Link], [Link],
i.coverage_amount,
b.num_adults, b.num_infants, b.total_price, b.booking_date
FROM bookings b
JOIN destinations d ON b.destination_id = [Link]
LEFT JOIN hotels h ON b.hotel_id = [Link]
LEFT JOIN insurance i ON b.insurance_id = [Link]
WHERE b.customer_id=%s
ORDER BY b.booking_date DESC

34
''', (customer[0],))
rows = [Link]()
if not rows:
print("\nYou have no bookings to cancel.")
return
print("\n===== Your Current Bookings =====")
for r in rows:
bid, dest_id, dest_name, pkg, hotel_name, ins_name, ins_price, ins_cov, adults, infants, total,
bdate = r
print(f"\nBooking ID: {bid} | Destination ID: {dest_id} | {dest_name} ({pkg})")
print(f" Hotel: {hotel_name if hotel_name else 'No hotel selected'}")
if ins_name:
print(f" Insurance: {ins_name} | Price: ₹{ins_price} | Coverage: ₹{ins_cov}")
else:
print(" Insurance: None")
print(f" Travelers: Adults-{adults}, Infants-{infants}")
print(f" Total Paid: ₹{total} | Booked On: {bdate}")
print("-------------------------------")
# Ask for Booking ID to cancel
while True:
bid_input = input("\nEnter the Booking ID to cancel (or 'back' to return): ").strip()
if bid_input.lower() == 'back':
return
if not bid_input.isdigit():
print("Please enter a numeric Booking ID or 'back'.")
continue
bid = int(bid_input)
[Link]("SELECT id, destination_id, hotel_id, insurance_id, total_price FROM bookings
WHERE id=%s AND customer_id=%s", (bid, customer[0]))
booking = [Link]()
if not booking:
print("No booking found with that ID belonging to your account. Try again.")
continue
# Show full details
bkid, dest_id, hid, iid, tot = booking[0], booking[1], booking[2], booking[3], booking[4]

35
[Link]("SELECT name, package_type, travel_method, start_datetime FROM
destinations WHERE id=%s", (dest_id,))
destinfo = [Link]()
hotelinfo = None
if hid:
[Link]("SELECT hotel_name, type FROM hotels WHERE id=%s", (hid,))
hotelinfo = [Link]()
insinfo = None
if iid:
[Link]("SELECT name, price, coverage_amount FROM insurance WHERE id=%s",
(iid,))
insinfo = [Link]()
print("\n--- Booking Details ---")
print(f"Booking ID: {bkid}")
if destinfo:
print(f"Destination: {destinfo[0]} | Package: {destinfo[1]} | Travel: {destinfo[2]} | Start:
{destinfo[3]}")
print(f"Hotel: {hotelinfo[0] + ' (' + hotelinfo[1] + ')' if hotelinfo else 'None'}")
if insinfo:
print(f"Insurance: {insinfo[0]} | Price: ₹{insinfo[1]} | Coverage: ₹{insinfo[2]}")
else:
print("Insurance: None")
print(f"Total Paid: ₹{tot}")
print("------------------------")
confirm = input("Are you sure you want to cancel this booking? (yes/no): ").strip().lower()
if confirm == 'yes':
[Link]("DELETE FROM bookings WHERE id=%s AND customer_id=%s", (bkid,
customer[0]))
[Link]()
print("Booking cancelled successfully.")
else:
print("Cancellation aborted.")
return
# ---------------------------
# Menus
# ---------------------------

36
def customer_portal():
while True:
print("\n--- CUSTOMER LOGIN / SIGNUP ---")
print("1. Login")
print("2. Signup")
print("3. Back")
choice = input("Enter choice: ").strip()
if choice == '1':
user = customer_login()
if user:
customer_menu(user)
elif choice == '2':
customer_signup()
elif choice == '3':
print("Returning to main menu...")
break
else:
print("Invalid choice. Try again.")
def customer_menu(user):
while True:
print("\n===============================")
print(" HIMALAYAN TRAVEL AGENCY")
print("===============================")
print("1. View Destinations")
print("2. Book a Tour")
print("3. View Bookings")
print("4. Cancel Booking")
print("5. Back to Main Menu")
print("===============================")
choice = input("Enter your choice: ").strip()
if choice == '1':
view_destinations()
elif choice == '2':
book_tour(user)
elif choice == '3':

37
view_bookings(user)
elif choice == '4':
cancel_booking(user)
elif choice == '5':
print("Returning to main menu...")
break
else:
print("Invalid choice. Try again.")
# ---------------------------
# Main menu
# ---------------------------
def login_menu():
while True:
print("\n===============================")
print(" HIMALAYAN TRAVEL AGENCY")
print("===============================")
print("1. Admin Login")
print("2. Customer Login / Signup")
print("3. Exit")
print("===============================")
choice = input("Enter choice: ").strip()
if choice == '1':
uname = input("Admin username: ").strip()
pwd = input("Admin password: ").strip()
[Link]("SELECT * FROM admin WHERE username=%s AND password=%s", (uname,
pwd))
admin = [Link]()
if admin:
admin_menu()
else:
print("Invalid admin credentials.")
elif choice == '2':
customer_portal()
elif choice == '3':
print("Thank you for using Himalayan Travel Agency. Goodbye!")

38
break
else:
print("Invalid choice. Try again.")
# ---------------------------
# Start
# ---------------------------
if __name__ == "__main__":
login_menu()

39
40
INCORRECT PASSWORD

CORRECT PASSWORD

1. Admin menu

41
ADDING A DESTINATION

ADMIN MENU

42
ADDING A HOTEL TO A DESTINATION
VIEWING DESTINATION

ADMIN MENU

43
ADDING HOTEL
First room

Second room

44
ADMIN MENU

Adding insurance
First:

Second:

45
ADMIN MENU

Viewing all destinations

46
47
ADMIN MENU

48
Viewing hotels

ADMIN MENU

Viewing insurance

49
ADMIN MENU

Removing a destination

Before:

After:

50
ADMIN MENU

Removing hotel from destination id1

Before:

After:

51
ADMIN MENU

Removing insurance from destination id1

Before:

After:

52
ADMIN MENU

Going back to the main menu

2. CUSTOMER LOGIN/SIGNUP

53
CUSTOMER SIGNUP

CUSTOMER LOGIN:
INCORRECT LOGIN

CORRECT LOGIN

54
VIEWING DESTINATIONS

55
56
BOOKING A TOUR

57
VIEW BOOKINGS

58
CANCEL BOOKING

GOING BACK TO THE MAIN MENU

59
EXITING

ENTERING WRONG CHOICE

60
COMPUTER SCIENCE IN PYTHON VOL – I : BY SUMITA AROURA

COMPUTER SCIENCE IN PYTHON VOL – II : BY SUMITA AROURA

1. [Link]

2. [Link]

61
62

You might also like