0% found this document useful (0 votes)
2 views

ATM Document

The document outlines a project aimed at creating a banking system that simulates ATM functionalities using Python and SQL. It details hardware and software requirements, functions, modules, source code, and expected outputs. Additionally, it includes a bibliography for reference materials used in the project.

Uploaded by

Anupriya Gautam
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)
2 views

ATM Document

The document outlines a project aimed at creating a banking system that simulates ATM functionalities using Python and SQL. It details hardware and software requirements, functions, modules, source code, and expected outputs. Additionally, it includes a bibliography for reference materials used in the project.

Uploaded by

Anupriya Gautam
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

INDEX

SNo. TOPIC PAGE NO.


1. OBJECTIVE OF THE
PROJECT
2. HARDWARE
REQUIREMENTS
3. SOFTWARE
REQUIREMENTS
4. FUNCTIONS
5. MODULES
6. ABOUT THIS PROJECT

7. SOURCE CODE

8. OUTPUT

9. BIBLIOGRAPHY
OBJECTIVE OF THE PROJECT:
The objective of this project is to create a system that allows
users to perform banking transactions such as cash
withdrawals, deposits, and balance inquiries. The project is
typically designed to simulate the functionality of an actual ATM
machine. The application of Python programming language and
SQL database management system allows for the creation of a
user-friendly interface and efficient data management.

2
HARDWARE REQUIREMENTS:
 Processor: Intel Pentium 4 or later or compatible
 Hard Disk: 410GB or more
 RAM: 1GB or more
 Printer: Any
 Monitor: SVGA color monitor (touch screen or simple)
 Pointing Device: Touch pad or keys

SOFTWARE REQUIREMENTS:

 Python 3.9.0 or higher


 MYSQL 8.0

3
FUNCTION:
A function is a block of code, which only runs when it is called.
You can pass data, known as parameters, into a function. A
function can return data as a result.

1. Built-in functions: These predefined functions are always


available for use. Eg:- len(),int() etc.

2. Functions defined in modules: These are predefined


functions available in specific modules and can be used
only when that module is imported. Eg: random.randint()
gives a random integer value in a given interval. This is
available in the random module.
3. User defined functions: the user defines these functions.

Functions used in this project:

 cursor()
 execute()
 print()
 int()
 fetchall()
 commit()
 fetchone()
 connect()

4
MODULE:
A Python module is a file containing Python definitions and
statements. A module can define functions, classes, and
variables.
Modules used in this project:
Mysql.connector: This method sets up a connection, establishing
a session with the MySQL server. If no arguments are given, it
uses the already configured or default values. A connection with
the MySQL server can be established using either
the mysql.connector.connect() method or
the mysql.connector.MySQLConnection()

5
SOURCE CODE
import mysql.connector

mydb=mysql.connector.connect(host='localhost',user='root',password='Tig
er')
mycursor=mydb.cursor()

mycursor.execute("CREATE DATABASE IF NOT EXISTS ATM_MACHINE")


mycursor.execute("USE ATM_MACHINE")
mn = "CREATE TABLE IF NOT EXISTS RECORDS(ACCONT_NO INT(4)
PRIMARY KEY, PASSWORD INT(3), NAME VARCHAR(20), CR_AMT INT
DEFAULT(0), WITHDRAWL INT DEFAULT(0), BALANCE INT DEFAULT(0))"
mycursor.execute(mn)

conn=mysql.connector.connect(host='localhost',user='root',password='Tige
r',database=' ATM_MACHINE')
c1=conn.cursor()
print("=======================================================
=========================")

print(" WELCOME TO OUR ATM ")

print("=======================================================
=========================")

print("1.To create account")


print("2.To login")
print("3.Exit")
print("=======================================================
=========================")

op=int(input("Enter your choice :"))


print("=======================================================
=========================")

if op==1:
c="y"
6
while c=="y":
m=int(input("Enter a 4 digit number as account number:"))
cb="select * from records where ACCONT_NO={}".format(m)
c1.execute(cb)
d=c1.fetchall()
data=c1.rowcount
if data==1:

print("=======================================================
=========================")

print("This account number already exists:")


c=input("Do you want to continue y/n -")

print("=======================================================
=========================")

if c=="y":
continue
else:
print(" Thank you.")
print(" PLEASE CLOSE THIS FILE BEFORE
EXITING")
print("Visit again")

print("=======================================================
=========================")

else:
name=input("Enter your name:")
passw=int(input("Enter your pass word:"))
ab="insert into records(ACCONT_NO,PASSWORD,NAME)
values({},{},'{}')".format(m,passw,name)

print("=======================================================
=========================")

c1.execute(ab)
7
conn.commit()
print("Account sucessfully created")
print("The minimum balance is 1000 ")

print("=======================================================
=========================")

s=int(input("Enter the money to be deposited :"))

print("=======================================================
=========================")

sr="update records set CR_AMT={} where


ACCONT_NO={}".format(s,m)
c1.execute(sr)
conn.commit()
ef="update records set balance=cr_amt-withdrawl where
ACCONT_NO={}".format(m)
c1.execute(ef)
conn.commit()
print("sucessfully deposited")

print(" Thank you")


print(" PLEASE CLOSE THIS FILE BEFORE EXITING")
print("Visit again")
break
if op==2:
y="y"
while y=="y":

acct=int(input("Enter your account number:"))


cb="select * from records where ACCONT_NO={}".format(acct)
c1.execute(cb)
c1.fetchall()
data=c1.rowcount
if data==1:
pas=int(input("Enter your password :"))

8
print("=======================================================
=========================")

e="select password from records where


ACCONT_NO={}".format(acct)
c1.execute(e)
a=c1.fetchone()
d=list(a)
if pas==d[0]:
print("Successfully Logged In")
print("1.Depositng money")
print("2.withdrawing money")
print("3.Transfering money")
print("4.Checking balance")

print("=======================================================
=========================")

r=int(input("Enter your choice:"))

print("=======================================================
=========================")

if r==1:
amt=int(input("Enter the money to be deposited:"))

print("=======================================================
=========================")

sr="update records set CR_AMT=CR_AMT + {} where


ACCONT_NO={}".format(amt,acct)
c1.execute(sr)
conn.commit()
ef="update records set balance=cr_amt-withdrawl
where ACCONT_NO={}".format(acct)
c1.execute(ef)
conn.commit()
print("sucessfully deposited")
9
t=input("Do you want to continue y/n -")

print("=======================================================
=========================")

if t=="y":
continue
else:
print(" Thank you")
print(" PLEASE CLOSE THIS FILE BEFORE
EXITING")
if r==2:
amt=int(input("Enter the money to withdraw:"))

print("=======================================================
=========================")

ah="select BALANCE from records where


ACCONT_no={}".format(acct)
c1.execute(ah)
m=c1.fetchone()
if amt >m[0]:
print("Your are having less than",amt)
print("Please try again")

print("=======================================================
=========================")

else:
sr="update records set balance=balance - {} where
ACCONT_NO={}".format(amt,acct)
ed="update records set WITHDRAWL ={} where
ACCONT_NO={}".format(amt,acct)
c1.execute(ed)
c1.execute(sr)
conn.commit()
print("Please collect the amount")
y=input("do you want to continue y/n -")
10
if y=="y":
continue
else:
print(" Thank you")
print(" PLEASE CLOSE THIS FILE BEFORE
EXITING")

if r == 3:
act = int(input("Enter the account number to be
transferred: "))
cb = "SELECT * FROM records WHERE
ACCONT_NO = {}".format(act)
c1.execute(cb)
c1.fetchall()
data = c1.rowcount
if data == 1:
print(act, "number exists")
m = int(input("Enter the money to be transferred:
"))
ah = "SELECT BALANCE FROM records WHERE
ACCONT_NO = {}".format(acct)
c1.execute(ah)
c = c1.fetchone()
if m > c[0]:
print("You have less than", m)
print("Please try again")
else:
av = "UPDATE records SET BALANCE =
BALANCE - {} WHERE ACCONT_NO = {}".format(m, acct)
cv = "UPDATE records SET BALANCE =
BALANCE + {} WHERE ACCONT_NO = {}".format(m, act)
w = "UPDATE records SET WITHDRAWL =
WITHDRAWL + {} WHERE ACCONT_NO = {}".format(m, acct)
t = "UPDATE records SET CR_AMT = CR_AMT
+ {} WHERE ACCONT_NO = {}".format(m, act)
c1.execute(av)
c1.execute(cv)
c1.execute(w)
c1.execute(t)
11
conn.commit()
print("Successfully transferred")
y = input("Do you want to continue? (y/n): ")
if y == "y":
continue
else:
print(" Thank you")
print(" PLEASE CLOSE THIS FILE
BEFORE EXITING")
if r==4:
ma="select balance from records where
ACCONT_no={}".format(acct)
c1.execute(ma)
k=c1.fetchone()
print("Balance in your account=",k)

print("=======================================================
=========================")

y=input("do you want to continue y/n -")


if y=="y":
continue
else:
print(" Thank you")
print(" PLEASE CLOSE THIS FILE BEFORE
EXITING")

else:
print("Wrong password")

print("=======================================================
=========================")

y=input("do you want to continue y/n -")

else:
12
print("your Account does not exists")

if op==3:
print("Exiting")
print("Please close this file before exiting.")
c1.close()

13
OUTPUT

14
15
16
BIBLIOGRAPHY:
1. Book – Python by Sumita Arora
2. www.python.org
3. https://www.geeksforgeeks.org

17

You might also like