0% found this document useful (0 votes)
25 views2 pages

Jai

document

Uploaded by

jai sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Jai

document

Uploaded by

jai sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

print("############### WELCOME TO JAI's CAR RENT SERVICE

##############")
import mysql.connector as m
c=m.connect(host="localhost",user="root",passwd="WJ28@krhps",database="jai")
cu=c.cursor
car="create table cars(ccode varchar(3) primary key ,car_name varchar(20),carno.
varchar(15),colour varchar(10),modified(Y or N) varchar(3),replaced_parts
varchar(10),fuel_type varchar(10),status varchar(20) default 'available')"
user="create table user(ccode varchar(3) foreign key, name varchar(30),ownership
varchar(10),time_under_ownership(years) int, date_to_rent date, date_to_return
date)"
cu.execute(car)
cu.execute(user)
c.commit()
def showall():
s="select * from cars"
cu.execute(s)
j=cu.fetchall()
for i in j:
print(i)

def available():
a="select from cars where status='available'"
cu.execute(a)
aa=cu.fetchmany()
print(aa)

def on_rent():
r="select from cars where status='rented'"
cu.execute(r)
rr=cu.fetchmany()
print(rr)

def to_rent():
print("1. show all available","\n2.any specific you car you want to rent")
choice=int(input("enter your choice:"))
if choice==1:
available()
elif ch==2:
sp=input("enter the car name you want to rent")
bb="select * from cars where car_name='{}'".format(sp)
cu.execute(bb)
b=cu.fetchone()
print(b)
else:
print("INVALID CHOICE")
q=input("enter the ccode of car you want to enter:")
w=input("enter your name:")
e=input("date to rent the car:")
r=input("date to return the car:")
qq="insert into user (ccode, name, date_to_rent, date_to_return)
values('{}','{}','{}','{}')".format(q,w,e,r)
qqq="update cars set status='RENTED' where ccode='{}'".format(q)
cu.execute(qq)
cu.execute(qqq)
c.commit()
def list_a_vehicle():
print("--------- CAR DETAILS ----------")
bheem=input("enter ccode:")
chutki=input("enter you car model name:")
raju=input("enter car's colour:")
jagu=input("Is your car modified?")
dholu=input("no. of replace parts:")
bholu=input("enter fuel type:")
print("--------- CLIENT DETAILS -----------")
indraverma=input("enter your name:")
indumati=input("ownership?")
tuntun=input("time under ownership:")
senapati="insert into cars
values('{}','{}','{}','{}','{}','{}')".format(bheem,chutki,raju,jagu,dholu,bholu)
dhomketu="insert into user (ccode,name,ownership,time_under_ownership)
values('{}','{}','{}','{}')".format(bheem,indraverma,indumati,tuntun)
cu.execute(senapati)
cu.execute(dhomketu)
c.commit()
c='y'
while c=='y':
print("--------Available Options---------","\n1. Show All Car Details","\n2. Show
All Available cars","\n3. Show All Cars on Rent","\n4. To Rent a Car","\n5. To List
a Car To Rent")
kaddu=int(input("******ENTER YOUR CHOICE*******"))
if kaddu==1:
showall()
elif kaddu==2:
available()
elif kaddu==3:
on_rent()
elif kaddu==4:
to_rent()
elif ch==5:
list_a_vehicle()
else:
print("#### YOU HAVE MADE AN INVALID CHOICE ####")
continue

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy