Sample Project-CS
Sample Project-CS
PROJECT
IN
ATM
NAME : …………………………………………………………………………………….
BONAFIDE CERTIFICATE
PRINCIPAL
ACKNOWLEDGEMENT
I solemnly take the opportunity to thank all the helping hands who
made me to complete this project. First of all I thank the Almighty for keeping me
hale and healthy in order to successfully complete my work.
Last but not the least, I express my heartiest thanks to my lovable parents
and friends for their prayers, suggestions and encouragement for the successful
completion of the project.
Sincerely,
CONTENTS
INTRODUCTION
SOURCE CODE
SAMPLE OUTPUT
CONCLUSION
BIBLIOGRAPHY
INTRODUCTION
Python is an interpreted, high-level, general-purpose programming
language. Created by Guido van Rossum and first released in 1991,
Python’s design philosophy emphasizes code readability with its
notable use of significant whitespace. Its language constructs and
object-oriented approach aim to help programmers write clear, logical
code for small and large scale objects.
RAM : 2 GB (Minimum)
4 GB (Recommended)
import mysql.connector
import time
import random
import json
import pickle
import matplotlib.pyplot as py
#------------------------------------------------------------------------------------
print(" ************************************")
cardlist=[]
mydb=mysql.connector.connect(host="localhost",user="root",passwd="123456",database="ATM")
mycursor=mydb.cursor()
print("\n|----------------------------------------------------------------------------|")
data=(name,age,ac,cn,pn,bal,typ)
mycursor.execute(qry,data)
mydb.commit()
cardlist.append(cn)
ballist=[bal] #For storing all the balance values for plotting balance monitor
localtime1=time.asctime(time.localtime(time.time()))
datelist=[localtime1]
print("\n|----------------------------------------------------------------------------|")
while True:
if cn not in cardlist:
continue
pin1=int(input("Enter the PIN number:"))
print("\n|--------------------------------------------------------------------------|")
#VARIABLES--------------------------------------------------------------------------
crd=mycursor.fetchone()
card=crd[0]
pn=mycursor.fetchone()
pin=pn[0]
nm=mycursor.fetchone()
name=nm[0]
acn=mycursor.fetchone()
acc=acn[0]
mycursor.execute("select Balance_Amt from User where Card_Number=%s"%(cn,))
blm=mycursor.fetchone()
bal=blm[0]
act=mycursor.fetchone()
typ=act[0]
ag=mycursor.fetchone()
age=ag[0]
piewithdrawal=0
piedeposit=0
piefund=0
piepin=0
#ACCOUNT DETAILS------------------------------------------------------------------
if pin==pin1:
print(" ---------------")
else:
continue
#FUNCTIONS---------------------------------------------------------------------------
def Cash_Withdrawal():
global bal
global piewithdrawal
if num==pin:
while True:
if amt>bal:
sys.stderr.write("Insufficient Balance!\n")
continue
else:
bal=bal-amt
ballist.append(bal)
one=(bal,cn)
mycursor.execute(upd,one)
mydb.commit()
time.sleep(2)
accdict={"NAME":name,"AGE":age,"ACCOUNT NO.":acc,"CARNUMBER":card,
accdict["Amount Withdrawn"]=amt
localtime=time.asctime(time.localtime(time.time()))
datelist.append(localtime)
accdict["Date_And_Time"]=localtime
myfile=open(r"C:\Users\admin\Desktop\RECEIPT.txt","w")
myfile.writelines(json.dumps(accdict))
trans=open(r"C:\Users\admin\Desktop\Transaction_History.dat","ab")
dict={"Amount Withdrawn":amt,"Balance":bal,"Date_And_Time":localtime}
pickle.dump(dict,trans)
trans.close()
print("\n|-----------------------------------------------------------------|")
piewithdrawal+=1
break
else:
sys.stderr.write("Incorrect PIN\n")
def Cash_Deposit():
global bal
global piedeposit
num=int(input("Enter your 4 Digit PIN:"))
if num==pin:
print("\nAccount Type:",typ)
bal=bal+amt
ballist.append(bal)
one=(bal,cn)
mycursor.execute(upd,one)
mydb.commit()
time.sleep(2)
AMT":bal,"ACCOUNT TYPE":typ}
accdict["Amount Deposited"]=amt
localtime=time.asctime(time.localtime(time.time()))
datelist.append(localtime)
accdict["Date_And_Time"]=localtime
myfile=open(r"C:\Users\admin\Desktop\RECEIPT.txt","w")
myfile.writelines(json.dumps(accdict))
trans=open(r"C:\Users\admin\Desktop\Transaction_History.dat","ab")
dict={"Amount Deposited":amt,"Balance":bal,"Date_And_Time":localtime}
pickle.dump(dict,trans)
trans.close()
print("\n|--------------------------------------------------------------------|")
piedeposit+=1
else:
sys.stderr.write("Incorrect PIN\n")
def Fund_Transfer():
global bal
global piefund
if num==pin:
print("\nAccount Type:",typ)
print("\nProcessing")
time.sleep(2)
bal=bal-amt
ballist.append(bal)
one=(bal,cn)
mycursor.execute(upd,one)
mydb.commit()
accdict["Amount Transferred"]=amt
accdict["Beneficiary AC Number"]=ben
localtime=time.asctime(time.localtime(time.time()))
datelist.append(localtime)
accdict["Date_And_Time"]=localtime
myfile=open(r"C:\Users\admin\Desktop\RECEIPT.txt","w")
myfile.writelines(json.dumps(accdict))
trans=open(r"C:\Users\admin\Desktop\Transaction_History.dat","ab")
"Date_And_Time":localtime}
pickle.dump(dict,trans)
trans.close()
print("\n|---------------------------------------------------------------|")
piefund+=1
break
elif amt>bal:
sys.stderr.write("Insufficient Balance\n")
continue
elif amt>50000:
continue
else:
sys.stderr.write("Incorrect PIN\n")
def Pin_Change():
global piepin
if num==pin:
if pin2==num:
while True:
if pin3==pin4:
one=(pin3,cn)
mycursor.execute(upd,one)
mydb.commit()
localtime=time.asctime(time.localtime(time.time()))
act=open(r"C:\Users\admin\Desktop\Activity.dat","ab")
dict1={"Activity":"PIN Changed","Date_And_Time":localtime}
pickle.dump(dict1,act)
act.close()
print("\n|--------------------------------------------------------------|")
piepin+=1
break
else:
continue
else:
else:
sys.stderr.write("Incorrect PIN\n")
def Acc_Info():
print("---------------------------")
if choose==1:
hist=open(r"C:\Users\admin\Desktop\Transaction_History.dat","rb")
while True:
try:
hist1=pickle.load(hist)
print(hist1)
except EOFError:
break
if choose==2:
if get==1:
info=[piewithdrawal,piedeposit,piefund,piepin]
py.pie(info,labels=data,autopct="%2.2f%%")
py.title("No. of Transactions")
py.show()
elif get==2:
py.plot(ballist,datelist,"g",linestyle="dotted",marker="d")
py.xlabel("Balance(INR)")
py.title("Balance Monitor")
py.show()
if choose==3:
try:
hist=open(r"C:\Users\admin\Desktop\Activity.dat","rb")
while True:
try:
hist1=pickle.load(hist)
print(hist1)
except EOFError:
break
except FileNotFoundError:
#MAIN--------------------------------------------------------------------------------
print("\n|------------------------------------------------------------------------|")
print("\n S E R V I C E S")
print(" ===============")
while True:
choice=int(input("\n<> Select the Serial Number of the Service you want or Hit 6 to EXIT:"))
if choice==1:
Cash_Withdrawal()
elif choice==2:
Cash_Deposit()
elif choice==3:
Fund_Transfer()
elif choice==4:
Pin_Change()
elif choice==5:
Acc_Info()
elif choice==6:
break
else:
break
SAMPLE OUTPUT
W E L C O M E T O T H E A T M
************************************
|------------------------------------------------------------------|
|-------------------------------------------------------------------|
|-------------------------------------------------------------------|
ACCOUNT DETAILS
--------------
NAME : Hari
AGE : 19
|-------------------------------------------------------------------|
S E R V I C E S
===============
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:1
|------------------------------------------------------------------|
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:2
|-------------------------------------------------------------------|
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:3
Processing
|-------------------------------------------------------------------|
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:4
|-------------------------------------------------------------------|
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:5
---------------------------
3.Account Activity
Enter Your Choice:1
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:5
---------------------------
---------------------------
---------------------------
<> Select the Serial Number of the Service you want or Hit 6 to EXIT:6
>>>
CONCLUSION
This program is an operative and efficient prototype of an
Automated Teller Machine. The program interface is simple and
suits any type of users. The program is a multi-utility device which
makes it versatile. It comes with every type of service that you
need in daily life like cash withdrawal, money transfer and account
visualization.
www.google.com
www.stackexchange.com
www.wikipedia.com
www.w3schools.com