ATM Machine
ATM Machine
ATM Machine
Submitted By: -
Name – Shanmughavel.S
Class – “XII-A”
Roll No – 06
Subject – Computer Science
Certificate of Accomplishment
This is to certify that SHANMUGHA VEL, a student of class “XII-A”(Vidhya
Parthi National Academy), has successfully completed the project on the topic
“History of Mathematicians”.
Sign -
Acknowledgement
✓ OS Module
✓ Platform Module
✓ MySQL. Connector Module
✓ Date Time Module
Functions Used in the Project
✓ Cursor()
✓ Append()
✓ Commit()
✓ Execute()
✓ Fetchall()
✓ Quit()
Uses of Functions
Cursor():
→It is a special control structure that facilitates the row-by-row
processing of records in the result set.
Append():
→It is adds an element or an value to the end of the desired list.
Commit():
→This function provides changes in the database physically.
Execute():
→This function is used to execute the sql query and retrive
records using python.
FetchallI():
→This function will return all the rows from the result set in the
form of a tuple containing the records.
Quit():
→This function is used to close an program file.
SOURCE CODE
import os
import platform
import mysql.connector
import datetime
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root",d
atabase="hotel",charset="utf8")
mycursor=mydb.cursor()
def registercust():
L=[]
custno=int(input('Enter customer no='))
L.append(custno)
name=input('Enter name:')
L.append(name)
addr=input('Enter address:')
L.append(addr)
jr_date=input('Enter date of journey:')
L.append(jr_date)
source=input('Enter source:')
L.append(source)
destination=input('Enter destination:')
L.append(destination)
cust=(L)
sql='insert into pdata(custno,custname,addr,jrdate,source,destination)
values(%s,%s,%s,%s,%s,%s)'
mycursor.execute(sql,cust)
mydb.commit()
def ticketprice():
L=[]
cno=int(input('Enter custoner no='))
L.append(cno)
print('We have the following rooms for you:-')
print('1. type First class--->rs 6000 PN\-')
print('2. type Business class--->rs 4000 PN\-')
print('3. type Economy class--->rs 2000 PN\-')
x=int(input('Enter your choice:'))
n=int(input('Enter No. of Passengers:'))
if x==1:
print('you have opted First class.')
s=6000*n
L.append(s)
elif x==2:
print('you have opted Business class.')
s=4000*n
L.append(s)
elif x==3:
print('you have opted Economy class.')
s=2000*n
L.append(s)
else:
print('Please select a class type.')
print('your ticket charge is =',s,'\n')
print('Extra luggage charge 100 rs per kg')
def dis():
custno=int(input("Enter the customer number whose bill to be viewed :
"))
sql="Select pdata.custno, pdata.custname,
pdata.addr,pdata.source,pdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot
from pdata INNER JOIN tkt ON pdata.custno=tkt.custno and tkt.custno
= %s"
rl=(custno,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
for x in res:
print(x)
def dispall():
sql="Select pdata.custno, pdata.custname,
pdata.addr,pdata.source,pdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot
from pdata INNER JOIN tkt ON pdata.custno=tkt.custno"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The Customer details are as follows : ")
for x in res:
print(x)
def Menuset():
print('Enter 1: To enter customer data.')
print('Enter 2: For ticketamount.')
print('Enter 3: Display customerwise Details.')
print('Enter 4: Display All Details.')
print('Enter 5: Exit')
userinput=int(input('Enter your choice:'))
if userinput==1:
registercust()
elif userinput==2:
ticketprice()
elif userinput==3:
dis()
elif userinput==4:
dispall()
elif userinput==5:
quit()
else:
print('Enter correct choice.')
Menuset()
def runagain():
runagn=input('\nWant to run again? y/n:')
while runagn=='y':
if platform.system=='windows':
print(os.system('cls'))
else:
print(os.system('clear'))
Menuset()
runagn=input('\nWant to run again? y/n:')
runagain()
BIBILOGRAPHY
We used many references to develop this project and those are:-
✓ Computer Book Class XII-Sumit Arora
✓ WWW.Stackoverflow.com
THANKING YOU