0% found this document useful (0 votes)
27 views17 pages

Computerproject Class 12

The project is for class 12 cbse computer science students This project is basically based on planning a trip with desired budget

Uploaded by

Manikandan S S
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)
27 views17 pages

Computerproject Class 12

The project is for class 12 cbse computer science students This project is basically based on planning a trip with desired budget

Uploaded by

Manikandan S S
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
You are on page 1/ 17

JAWAHAR HIGHER SECONDARY SCHOOL

COMPUTER SCIENCE

TOPIC : TRIP TUNER


‘TUNE YOUR TRAVEL TO YOUR BUDGET’

Project Contributors :

THIVAKARAN .A CLASS & SEC :


AKASH KRISHNAN .R XII - H
ARUL SAKTHI GANESH .M
BONAFIDE CERTIFICATE

NAME : THIVAKARAN . A
CLASS : XII-H
SUBJECT : COMPUTER SCIENCE
REGISTRATION NUMBER :

This is to certify that the above-mentioned student of


Class XII –‘H’ section, Jawahar Higher Secondary School,
Neyveli has completed the CS project during the
academic year 2024 - 2025 for the AISSCE as
prescribed by CBSE

Submitted on:

INTERNAL EXAMINER EXTERNAL EXAMINER


I Wish To Express My Sincere Gratitude To Our
Principal , Mrs . M . Sethumani For Providing All
Facilities To Complete This Project Successfully.

I Extent My Hearty Thanks To Our Computer


Science Teacher , Mrs . Uma Maheswari , For Her
Valuable Guidance And Support In Completing This
Project Work . Without her motivation and help,
the successful completion of this project would not
have been possible.
S.NO CONTENT PAGE NO.
1. INTRODUCTION 5
2. MYSQL 6
3. PYTHON SOURCE CODE 9
4. OUTPUTS 13
5. BIBILOGAPHY 17
Traveling is a delightful experience, but
planning the expenses for a trip can often be
challenging . The project aims to provide the
perfect / ideal place to go for a vacation with
in the given budget .

MODULES IMPORTED:
*Mysql.connecotr
FUNCTIONS USED:
*connet()
*cursor()
*fetchall()
CREATE DATABASE trip_planner;
USE trip_planner;
CREATE TABLE destinations (
id INT AUTO_INCREMENT PRIMARY KEY,
place_name VARCHAR(100),
location_type VARCHAR(50),
budget_range VARCHAR(50),
estimated_cost INT
);

TABLE : Destinations

INSERT INTO destinations (place_name,


location_type, budget_range, estimated_cost)
VALUES
('Paris', 'international', 'high', 100000),
('New York', 'international', 'high',
120000),
('Tokyo', 'international', 'high', 110000),
('Bangkok', 'international', 'medium',
70000),
('Bali', 'international', 'medium', 60000),
('Kathmandu', 'international', 'low',
40000),
('Dubai', 'international', 'medium', 80000),
('Goa', 'national', 'medium', 30000),
('Kerala', 'national', 'medium', 35000),
('Manali', 'national', 'low', 15000),
('Leh Ladakh', 'national', 'high', 50000),
('Jaipur', 'national', 'low', 20000),
('Andaman and Nicobar Islands', 'national',
'high', 55000),
('Rishikesh', 'state', 'low', 10000),
('Shimla', 'state', 'low', 12000),
('Mysore', 'state', 'medium', 25000),
('Pondicherry', 'state', 'medium', 27000),
('Darjeeling', 'state', 'medium', 24000),
('Lonavala', 'state', 'low', 10000),
('Ooty', 'state', 'low', 15000);
TABLE - Destinations(after inserting values)
import mysql.connector

# Connecting to MySQL Database


def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="system@123",
database="trip_planner"
)

# Function to get trip suggestions


def get_trip_suggestions(budget,
trip_type):
db = connect_to_db()
cursor = db.cursor()
query = "SELECT place_name,
estimated_cost FROM destinations
WHERE location_type=%s AND
estimated_cost<=%s"
cursor.execute(query, (trip_type,
budget))
results = cursor.fetchall()
if not results:
print("No trips found within
your budget.")
else:
print("Here are some
suggestions for your {trip_type} trip
within your budget of {budget}:")
for row in results:
print(f"{row[0]} -
Estimated cost: {row[1]}")

cursor.close()
db.close()

# Function to save trip details to a


file
def save_trip_to_file(trip_details):
with open("saved_trips.txt", "a")
as file:
file.write(trip_details + "\n")
print("Trip saved to file.")

# Function to view saved trips


def view_saved_trips():
try:
with open("saved_trips.txt",
"r") as file:
trips = file.readlines()
if trips:
print("Previously saved
trips:")
for trip in trips:
print(trip.strip())
else:
print("No saved trips
found.")
except FileNotFoundError:
print("No saved trips found.")

# Main program
def main():
print("Welcome to Trip Planner!")
budget = int(input("Enter your
budget: "))
print("Choose trip type: 1.
International 2. National 3. Within
State")
choice = int(input("Enter choice
(1/2/3): "))

if choice == 1:
trip_type = 'international'
elif choice == 2:
trip_type = 'national'
elif choice == 3:
trip_type = 'state'
else:
print("Invalid choice!")
return

get_trip_suggestions(budget,
trip_type)
save_choice = input("Do you want to
save this trip plan? (yes/no):
").lower()
if save_choice == 'yes':
trip_details = f"Trip Type:
{trip_type}, Budget: {budget}"
save_trip_to_file(trip_details)

view_choice = input("Do you want to


view previously saved trips? (yes/no):
").lower()
if view_choice == 'yes':
view_saved_trips()

main()
Welcome to Trip Planner!
Enter your budget: 300000
Choose trip type: 1. International 2. National 3. Within
State
Enter choice (1/2/3): 1
Here are some suggestions for your international trip
within your budget of 300000:
Paris - Estimated cost: 100000
New York - Estimated cost: 120000
Tokyo - Estimated cost: 110000
Bangkok - Estimated cost: 70000
Bali - Estimated cost: 60000
Kathmandu - Estimated cost: 40000
Dubai - Estimated cost: 80000
Do you want to save this trip plan? (yes/no): yes
Trip saved to file.
Do you want to view previously saved trips? (yes/no): no
Welcome to Trip Planner!
Enter your budget: 20000
Choose trip type: 1. International 2. National 3. Within
State
Enter choice (1/2/3): 2
Here are some suggestions for your national trip within
your budget of 20000:
Manali - Estimated cost: 15000
Jaipur - Estimated cost: 20000
Do you want to save this trip plan? (yes/no): yes
Trip saved to file.
Do you want to view previously saved trips? (yes/no):
yes
Previously saved trips:
Trip Type: international, Budget: 300000
Trip Type: national, Budget: 20000
Welcome to Trip Planner!
Enter your budget: 10000
Choose trip type: 1. International 2. National 3. Within
State
Enter choice (1/2/3): 3
Here are some suggestions for your state trip within
your budget of 10000:
Rishikesh - Estimated cost: 10000
Lonavala - Estimated cost: 10000
Do you want to save this trip plan? (yes/no): yes
Trip saved to file.
Do you want to view previously saved trips? (yes/no):
yes
Previously saved trips:
Trip Type: international, Budget: 300000
Trip Type: national, Budget: 20000
Trip Type: state, Budget: 10000
Welcome to Trip Planner!
Enter your budget: 100000
Choose trip type: 1. International 2. National 3. Within
State
Enter choice (1/2/3): 3
Here are some suggestions for your state trip within
your budget of 100000:
Rishikesh - Estimated cost: 10000
Shimla - Estimated cost: 12000
Mysore - Estimated cost: 25000
Pondicherry - Estimated cost: 27000
Darjeeling - Estimated cost: 24000
Lonavala - Estimated cost: 10000
Ooty - Estimated cost: 15000
Do you want to save this trip plan? (yes/no): no
Do you want to view previously saved trips? (yes/no): no
1. PYTHON DOCUMENTAION
2. MYSQL DOCUMENTAION
3. WIKIPEDIA
4. NEWS API

THANK YOU !!!

You might also like