MCC_PS_cs
MCC_PS_cs
COMPUTER SCIENCE
INVESTIGATORY PROJECT
2023 - 2024
ATM MANAGEMENT
Submitted by
E.Edmund jonathan
1
S.NO TABLE OF CONTENTS PAGE
NO
1 CERTIFICATE 3
2 ACKNOWLEDGMENT 4
3 AIM 5
4 INTRODUCTION 5
5 HARDWARE REQUIREMENTS 8
6 SOFTWARE REQUIREMENTS 8
7 CONCEPT’S USED 9
8 FLOW CHART
9 PROGRAM CODE 22
10 OUTPUT 28
11 CONCLUSION 28
12 BIBLIOGRAPHY
2
BONAFIDE CERTIFICATE
This is to certify that E.Edmund Jonathan of XII-A
from MCC PUBLIC SCHOOL, has successfully
completed the Computer Science Investigatory Project
on the topic ATM Management. Under the guidance
of Ms.Mohanapriya during the academic year 2023-
2024 in partial fulfilment of Computer Science practical
examination conducted by AISSCE, Delhi.
School seal:
4
AIM:
To generate an ATM- Management system in Python,
using the inter-connectivity with MySql program in
IDLE or Visual Code.
INTRODUCTION:
This Python script is an implementation of a simple
ATM (Automated Teller Machine) management system
using MySQL as the database to store account
information. The script provides basic ATM
functionalities, such as creating accounts, logging in,
checking account balances, making deposits and
withdrawals, changing account details, and listing all
accounts stored in the database.
1. Database Interaction:
- It establishes a connection to a MySQL database on
a localhost server and creates a database called "atm" if
it doesn't already exist.
5
- It defines a table called "accounts" to store account-
related information, including account number, name,
password, balance, quick withdraw limit, account lock
status, and login attempts.
2. Account Creation:
- Users can create new accounts, and each account is
assigned a unique account number.
- Users provide their name, a strong password, initial
balance, and quick withdrawal limit when creating an
account.
- Account data is stored in the "accounts" table in the
database.
3. Account Login:
- Users can log in using their account number and
password.
- The script checks the provided credentials against
the database and grants access if they match.
5. Listing Accounts:
- Users have the option to view a list of all accounts
stored in the database.
7
8. Exit Option:
- Users can exit the ATM system when they are done
with their transactions.
HARDWARE REQUIERMENTS:
Processor: 12th Gen Intel(R) Core(TM) i7-12700 2.10
GHz
RAM: 16.0 GB
8
SOFTWARE REQUIREMENTS:
1. Python 3.11.4
2. MySql 8.0
3. MySql.connector
CONCEPT’S USED
Modules:
Random: Use to generate account number
MySQL. Connector: Use to connect python and
MySQL
Python:
While loop
Functions
My Sql:
Basic MySQL queries like:
Select
Insert, Update
9
PROGRAM CODE
import random
import mysql.connector
10
# CREATE THE 'ACCOUNTS' TABLE IF IT
DOSEN'T EXIST
def create_table(cursor):
cursor.execute("""CREATE TABLE IF NOT
EXISTS accounts (
account_number INT PRIMARY KEY,
name VARCHAR(20),
password VARCHAR(20),
balance INT,
quick_withdraw INT,
is_locked BOOLEAN,
login_attempts INT
)""")
if not account:
break
13
if account and account[2] == password:
print("Login successful. Welcome,", account[1])
account = list(account) # Convert the account
tuple to a list
logged_in = True
while logged_in:
logged_in = account_menu(connection, cursor,
account)
else:
print("Invalid account number or password.")
14
choice = input("Enter your choice: ")
if choice == "1":
show_balance(account)
elif choice == "2":
deposit(connection, cursor, account)
elif choice == "3":
withdraw(connection, cursor, account)
elif choice == "4":
change_account_details(connection, cursor,
account)
elif choice == "5":
print("Logged out successfully.")
return False
else:
print("Invalid choice. Please try again.")
return True
15
def show_balance(account):
print("--- Account Balance ---")
print("Balance:", account[3])
if choice == "1":
regular_withdraw(connection, cursor, account)
elif choice == "2":
quick_withdraw(connection, cursor, account)
else:
print("Invalid choice. Please try again.")
# REGULAR WITHDRAW
def regular_withdraw(connection, cursor, account):
amount = int(input("Enter the amount to withdraw:
"))
# QUICK WITHDRAW
def quick_withdraw(connection, cursor, account):
quick_limit = account[4]
18
else:
print("Insufficient balance for quick withdraw.")
if new_name or new_password:
update_values = {}
if new_name:
update_values["name"] = new_name
if new_password:
update_values["password"] = new_password
19
update_query += " WHERE account_number =
%s"
cursor.execute(update_query,
tuple(update_values.values()) + (account[0],))
connection.commit()
print("Account details updated.")
else:
print("No changes made to account details.")
if not accounts:
print("No accounts found.")
else:
print("--- Accounts ---")
for account in accounts:
print("Account Number:", account[0])
print("Name:", account[1])
20
print("---")
# Main program
def main():
connection = connect_to_database()
if connection is None:
return
cursor = connection.cursor()
create_database(cursor)
connection.database = "atm"
create_table(cursor)
while True:
print("________________________")
print(" --- ATM Management --- ")
print("1. Create account ")
print("2. Login ")
print("3. Show accounts ")
print("4. Exit ")
print("________________________")
21
choice = input("Enter your choice: ")
if choice == "1":
create_account(connection, cursor)
elif choice == "2":
login(connection, cursor)
elif choice == "3":
show_accounts(cursor)
elif choice == "4":
print("Exiting...")
print("THANK YOU")
break
else:
print("Invalid choice. Please try again.")
cursor.close()
connection.close()
22
# START THE PROGRAM
if __name__ == "__main__":
main()
23
OUTPUT:
PYTHON:
SQL:
PYTHON:
24
SQL:
PYTHON: 3
SQL: 3
25
PYTHON: 10
SQL: 10
PYTHON: 4
SQL: 4
26
PYTHON:
SQL:
PYTHON:
27
SQL:
PYTHON:
SQL:
28
PYTHON:
SQL:
PYTHON:
29
SQL:
CONCLUSION
BIBLIOGRAPHY
Source:
NCERT CS 12 text book
Trust me bro
30
31