Pawan Report
Pawan Report
SIDDHARTHNAGAR
COMPUTER SCIENCE INVESTIGATORY
PROJECT
SUbMITTED bY:-
PAWAN KUMAR
CLASS xII A
(2023-24)
ROLL NO:-
1
TABLE OF CONTENTS
Certificate
Undertaking
Acknowledgement
Introduction
About Python
Coding
Outputs
Bibliography
2
Certificate
_____________________
Signature of Principal
___________________ ___________________
Signature of Internal Signature of External
Examiner Examiner
3
Undertaking
4
Acknowledgement
____________________
(Signature of Student)
PAWAN KUMAR
5
SYNOPSIS
7
SYSTEM REQUIREMENTS
HARDWARE REQUIRED
SOFTWARE REQUIRED
8
INTRODUCTION
9
adding, searching, updating, and deleting
details.
It helps you do things like checking how much
money you have, putting more money into
your account (like when you get your
allowance), taking money out (when you need it
for something special), and making sure that
bad things, like people trying to take your
money without permission, don't happen.
Moreover, this helper makes banking more
Convenient by allowing you to do these things
not just at the bank but also using a computer
or even your phone. So, the purpose is to
make banking simple, safe.
Bank Management System implemented in
Python using a binary file for data storage.
Here's an overview of the key components:
1. **Account Class:**
- Represents a bank account with attributes
such as account number, account holder name,
10
account type (Checking/Saving), and account
balance.
- Provides methods for creating an account,
displaying account details, modifying account
information, depositing and withdrawing
amounts, and generating an account report.
2. **User Class:**
- Represents a user with a username and
password. Used for basic authentication in your
system.
3. **Functions:**
- **intro():** Displays the introduction
message for the Bank Management System.
- **save_users(users):** Saves user
information to a binary file named "users.data."
- **load_users():** Loads user information
from the "users.data" file.
- **register():** Allows a user to register by
entering a new username and password.
11
- **login():** Authenticates a user by
checking the entered username and password
against stored user data.
- **writeAccount():** Creates a new bank
account and writes it to the "accounts.data" file.
- **displayAll():** Displays details of all
existing accounts.
- **displaySp(num):** Displays the balance
for a specific account number.
- **depositAndWithdraw(num1, num2):**
Allows depositing or withdrawing an amount
from a specific account.
- **deleteAccount(num):** Closes an
account based on the account number.
- **modifyAccount(num):** Modifies
account details based on the account number.
- **writeAccountsFile(account):** Writes
account information to the "accounts.data" file.
12
- Utilizes a while loop to present a menu of
options to the user.
- Options include creating a new account,
depositing or withdrawing money, checking
balance, displaying account holders, closing an
account, modifying an account, and exiting the
program.
5. **File Handling:**
- Uses binary files ("users.data" and
"accounts.data") to store user authentication
data and account information, respectively.
- Pickle module is employed for serializing
and deserializing Python objects to/from binary
files.
6. **User Interaction:**
- Interacts with the user through input
prompts and provides feedback on actions
performed.
13
The project employs basic authentication, and
the password is entered in plaintext. In a real-
world scenario, it is advisable to use more
secure authentication mechanisms and store
passwords securely.
14
ABOUT PYHTON
15
CODING
def createAccount(self):
self.accNo= int(input("Enter the account no : "))
self.name = input("Enter the account holder name : ")
self.type = input("Ente the type of account [C/S] : ")
self.deposit = int(input("Enter The Initial amount(>=500 for Saving and >=1000 for
current"))
#self.password=input("Enter your password: ")
print("\n\n\nAccount Created")
def showAccount(self):
print("Account Number : ",self.accNo)
print("Account Holder Name : ", self.name)
print("Type of Account",self.type)
16
print("Balance : ",self.deposit)
def modifyAccount(self):
print("Account Number : ",self.accNo)
self.name = input("Modify Account Holder Name :")
self.type = input("Modify type of Account :")
self.deposit = int(input("Modify Balance :"))
def depositAmount(self,amount):
self.deposit += amount
print("Amount deposit successfully")
def withdrawAmount(self,amount):
self.deposit -= amount
print("Amount withdraw successfully")
def report(self):
print(self.accNo, " ",self.name ," ",self.type," ", self.deposit)
def getAccountNo(self):
return self.accNo
def getAcccountHolderName(self):
return self.name
def getAccountType(self):
return self.type
def getDeposit(self):
return self.deposit
class User:
17
def __init__(self, username, password):
self.username = username
self.password = password
def intro():
print("\t\t\t\t**************************")
print("\t\t\t\tBANK MANAGEMENT SYSTEM")
print("\t\t\t\t********KVSDDN***********")
def save_users(users):
with open("users.data", "wb") as user_file:
pickle.dump(users, user_file)
def load_users():
if os.path.exists("users.data"):
with open("users.data", "rb") as user_file:
return pickle.load(user_file)
else:
return []
def register():
username = input("Enter a new username: ")
password = input("Enter a password: ")
users = load_users()
users.append(User(username, password))
save_users(users)
18
def login():
global num
username = input("Enter your username: ")
password = input("Enter your password: ")
num = int(input("Enter The account No. : "))
users = load_users()
for user in users:
if user.username == username and user.password == password:
print("Login successful!")
return True
def writeAccount():
account = Account()
account.createAccount()
writeAccountsFile(account)
def displayAll():
file = pathlib.Path("accounts.data")
if file.exists():
infile = open('accounts.data', 'rb')
mylist = pickle.load(infile)
infile.close()
if not mylist:
19
print("No records to display")
return
else:
print("No records to display")
def displaySp(num):
file = pathlib.Path("accounts.data")
if file.exists ():
infile = open('accounts.data','rb')
mylist = pickle.load(infile)
infile.close()
found = False
for item in mylist :
if item.accNo == num :
print("Your account Balance is = ",item.deposit)
found = True
else :
print("No records to Search")
if not found :
print("No existing record with this number")
20
def depositAndWithdraw(num1,num2):
file = pathlib.Path("accounts.data")
if file.exists ():
infile = open('accounts.data','rb')
mylist = pickle.load(infile)
infile.close()
os.remove('accounts.data')
for item in mylist :
if item.accNo == num1 :
if num2 == 1 :
amount = int(input("Enter the amount to deposit : "))
item.deposit += amount
print("Your account is updated successfully")
print("Your accounts balance is =", item.deposit)
elif num2 == 2 :
amount = int(input("Enter the amount to withdraw : "))
if amount <= item.deposit :
item.deposit -=amount
print("Your accounts balance is =", item.deposit)
else :
print("You cannot withdraw larger amount")
else :
print("No records to Search")
outfile = open('newaccounts.data','wb')
pickle.dump(mylist, outfile)
outfile.close()
os.rename('newaccounts.data', 'accounts.data')
21
def deleteAccount(num):
file = pathlib.Path("accounts.data")
if file.exists ():
infile = open('accounts.data','rb')
oldlist = pickle.load(infile)
infile.close()
newlist = []
for item in oldlist :
if item.accNo != num :
newlist.append(item)
os.remove('accounts.data')
outfile = open('newaccounts.data','wb')
pickle.dump(newlist, outfile)
outfile.close()
os.rename('newaccounts.data', 'accounts.data')
def modifyAccount(num):
file = pathlib.Path("accounts.data")
if file.exists ():
infile = open('accounts.data','rb')
oldlist = pickle.load(infile)
infile.close()
os.remove('accounts.data')
for item in oldlist :
if item.accNo == num :
item.name = input("Enter the account holder name : ")
item.type = input("Enter the account Type : ")
22
item.deposit = int(input("Enter the Amount : "))
outfile = open('newaccounts.data','wb')
pickle.dump(oldlist, outfile)
outfile.close()
os.rename('newaccounts.data', 'accounts.data')
def writeAccountsFile(account) :
file = pathlib.Path("accounts.data")
if file.exists ():
infile = open('accounts.data','rb')
oldlist = pickle.load(infile)
oldlist.append(account)
infile.close()
os.remove('accounts.data')
else :
oldlist = [account]
outfile = open('newaccounts.data','wb')
pickle.dump(oldlist, outfile)
outfile.close()
os.rename('newaccounts.data', 'accounts.data')
23
intro()
print( " WELCOME!! ")
while ch != 8:
#system("cls");
print("\tMAIN MENU")
print("\t1. NEW ACCOUNT")
print("\t2. DEPOSIT AMOUNT")
print("\t3. WITHDRAW AMOUNT")
print("\t4. BALANCE ENQUIRY")
print("\t5. ALL ACCOUNT HOLDER LIST")
print("\t6. CLOSE AN ACCOUNT")
print("\t7. MODIFY AN ACCOUNT")
print("\t8. EXIT")
print("\tSelect Your Option (1-8) ")
ch = input()
#system("cls");
if ch == '1':
register()
writeAccount()
elif ch =='2':
depositAndWithdraw(num, 1)
elif ch == '3':
if login():
depositAndWithdraw(num, 2)
elif ch == '4':
24
if login():
displaySp(num)
elif ch == '5':
displayAll();
elif ch == '6':
if login():
deleteAccount(num)
elif ch == '7':
if login():
modifyAccount(num)
elif ch == '8':
print("\tThanks for using bank managemnt system")
break
else :
print("Invalid choice")
25
OUTPUTS
MAIN MENU
NEW ACCOUNT
DEPOSIT AMOUNT
26
WITHDRAW AMOUNT
27
BALANCE ENQUIRY
28
ACCOUNT CLOSING
MODIFY ACCOUNT
29
EXIT MENU
30
LIMITATIONS & FUTURE
ENHANCEMENTS
1. www. python.org
2. www.mysql.com
3. www.google.com
4. Computer Science with Python by
Preeti Arora.
5. Computer Science with Python by
Sumita Arora.
32