Вы находитесь на странице: 1из 37

AMITY INTERNATIONAL SCHOOL

VIRAJ KHAND, LUCKNOW

CERTIFICATE

This is to certify that _______________ , a student of class XII has


successfully completed the research on the below mentioned project under
the guidance of Mrs. Cinderalla A Augustine (Teacher) during the year
2019-20 in the partial fulfillment of Computer Science practical
examination conducted by CBSE , New Delhi

Signature of Internal Examiner Signature of External Examiner

1
Online Banking System
ACKNOWLEDGEMENT

It is a great pleasure that I am penning down these lines to


express my sincere thanks to all those people who helped me in
completing this project.

The harmonious environment in our school provided the proper


atmosphere for preparing this project. It was a privilege to have
been guided by our Teacher Mrs. Cinderalla A Augustine,
Senior Coordinator Mrs.Suman Sood and our Principal Mrs.
Rachna Mishra.

I am also grateful to my classmates who have helped me during


the finalization of this project with their constructive criticism
and advice.

2
Online Banking System
Introduction to Python
Python is a powerful multi-purpose programming language created by Guido van
Rossum.

Python is an easy to learn, powerful programming language. It has efficient high-


level data structures and a simple but effective approach to object-oriented
programming. Python’s elegant syntax and dynamic typing, together with its
interpreted nature, make it an ideal language for scripting and rapid application
development in many areas on most platforms.

The Python interpreter and the extensive standard library are freely available in
source or binary form for all major platforms from the Python Web
site, https://www.python.org/, and may be freely distributed. The same site also
contains distributions of and pointers to many free third party Python modules,
programs and tools, and additional documentation.

The Python interpreter is easily extended with new functions and data types
implemented in C or C++ (or other languages callable from C). Python is also
suitable as an extension language for customizable applications.

Python is a cross-platform programming language, meaning, it runs on multiple


platforms like Windows, MacOS, Linux and has even been ported to the Java and
.NET virtual machines. It is free and open source.

Features of Python Programming


 A simple language which is easier to learn. Python has a very simple and elegant
syntax. ...
 Free and open-source. ...
 Portability. ...
 Extensible and Embeddable. ...
 A high-level, interpreted language. ...
 Large standard libraries to solve common tasks. ...
 Object-oriented

Python is a multi-paradigm programming language. Meaning, it supports different


programming approach.

3
Online Banking System
One of the popular approach to solve a programming problem is by creating
objects. This is known as Object-Oriented Programming (OOP).

An object has two characteristics:

 attributes
 behavior

Let's take an example:

Person is an object,

 name, age, color are attributes


 singing, dancing are behavior

The concept of OOP in Python focuses on creating reusable code. This concept is
also known as DRY (Don't Repeat Yourself).

In Python, the concept of OOP follows some basic principles:

A process of using details from a new class without modifying


Inheritance existing class.

Encapsulation Hiding the private details of a class from other objects.

A concept of using common operation in different ways for


Polymorphism different data input.

Class

A class is a blueprint for the object.

Object

An object (instance) is an instantiation of a class. When class is defined, only the


description for the object is defined. Therefore, no memory or storage is allocated.

4
Online Banking System
Methods

Methods are functions defined inside the body of a class. They are used to define
the behaviors of an object.

Inheritance

Inheritance is a way of creating new class for using details of existing class without
modifying it. The newly formed class is a derived class (or child class). Similarly,
the existing class is a base class (or parent class).

Encapsulation

Using OOP in Python, we can restrict access to methods and variables. This
prevent data from direct modification which is called encapsulation. In Python, we
denote private attribute using underscore as prefix i.e single “ _ “ or double “ __“.

Polymorphism

Polymorphism is an ability (in OOP) to use common interface for multiple form
(data types).

Suppose, we need to color a shape, there are multiple shape option (rectangle,
square, circle). However we could use same method to color any shape. This
concept is called Polymorphism.

What are exceptions in Python?


Python has many built-in exceptions which forces your program to output an error
when something in it goes wrong.

When these exceptions occur, it causes the current process to stop and passes it to
the calling process until it is handled. If not handled, our program will c

In Python, exceptions can be handled using a try statement.

A critical operation which can raise exception is placed inside the try clause and
the code that handles exception is written in except clause.

5
Online Banking System
Python File I/O

File is a named location on disk to store related information. It is used to


permanently store data in a non-volatile memory (e.g. hard disk).

Since, random access memory (RAM) is volatile which loses its data when
computer is turned off, we use files for future use of the data.

When we want to read from or write to a file we need to open it first. When we are
done, it needs to be closed, so that resources that are tied with the file are freed.

Hence, in Python, a file operation takes place in the following order.

1. Open a file
2. Read or write (perform operation)
3. Close the file

6
Online Banking System
Hardware and Software Specification

The Hardware used:

 Processor : Intel Pentium Gold G5400 CPU @ 3.70 GHz


 Hard Disk Space : 32 GB
 RAM : 1 GB RAM
 System Type : 64 bit OS

The Softwares used:

 Microsoft Windows 10 Pro as Operating System.

 Python 3.7

 Anaconda Navigator, Spyder

 MySQL as Back-end Sever with Database for Testing.

 MS-Word 2016 for documentation.

7
Online Banking System
Data Dictionary
Cust.dat
S.No. Name Description
1. ano Begins with 1001, generated automatically
2 Cname Should be only character
3 Addr Can have alpha numeric value
4 Phno Should have 10 digits
5 Doo Current date
6 atype Should accept “S” and “C”

Trans.dat
S.No Name Description
1 ano Should exits in cust.dat
2 atype Retrieved from cust.dat
3 ir Should be calculated based on the type of account
4 tamt Should be accepted from the user
5 cbal Should be updating the current balance
6 tdate Current date

Gen_cust.log
Begins with 1001 and generates the customer number automatically, when a
new customer opens an account in the bank.

8
Online Banking System
PROJECT DESCRIPTION

Aim and Objective


The aim of this project is to develop a Online Banking System that can handle &
manage the activities involved in a bank in an efficient & reliable way. Less
managing personnel & easy searching availability & user profile managing are
major goals in this project.

Objective:
-->Develop a system that can replace the manual bank managing system.
-->Develop a database which stores customer details & account details.
-->Give reliable search facility for the customer s.
-->Create an easy to understand user friendly environment.
-->Attractive user interfaces to navigate through the system for the customers.

Files :
There are five separate files that are being maintained.
• The cust.dat stores the details of the customer.
• The Trans.dat file stores the details of customers such as customer name,
account no., account type and balance.
• The Gen_cust.log to store the last member number to generate the next last
customer number.
Inputs:
• Addition, Modification and Deletion of Customer details.
• Transaction like withdrawl and deposit.
Outputs:
• Displaying the details of all the Customers.
• Transaction done in the bank on daily bases.
9
Online Banking System
SOURCE CODE
import pickle,os,datetime

Cfile="cust.dat"

Tfile="trans.dat"

#validation functions

def numerics(z):

while True:

try:

mn = int(z)

except ValueError:

print("Invalid Input.")

z = input('Enter a valid input')

else:

break

return mn

def balance(z):

while True:

try:

mn = int(z)

10
Online Banking System
if mn<2000:

z=input("Initial Deposit shd be above 2000, Re-enter the amount :")

return z

except ValueError:

print("Invalid Input.")

z = input('Enter a valid input')

else:

break

return mn

def string(z):

while True:

try:

if z.isalpha() == True:

return z

else:

raise ImportError

except ImportError:

print('Invalid Entry')

z = input('Enter a Valid Name:')

11
Online Banking System
def fixed(z, length):

while True:

try:

if len(z) != length:

raise ZeroDivisionError

else:

return z

except ZeroDivisionError:

print("Invalid Input")

z = input('Enter a valid input of ' + str(length) + ' digits')

def acct_type(z):

while True:

try:

if z in ('S','C'):

return z

else:

raise ImportError

except ImportError:

print('Invalid Choice')

z = input('Make a Valid Type Choice[ S for Saving Account, C for Current


Account ]')

12
Online Banking System
#Generator to generate account no. automatically

def counter(n):

while True:

yield n

n=n+1

with open("Gen_cust.log","rb+") as gf:

gf.write(str(n))

with open("Gen_cust.log","rb+") as gf:

try:

s=gf.read()

s=int(s)

except ValueError:

pass

ct=counter(s)

class cust:

def __init__(self,ano=0,cname='',addr='',phno=0,atype='',bal=0):

self.ano=ano

self.cname=cname

self.addr=addr

self.phno=phno

self.atype=atype
13
Online Banking System
self.bal=bal

self.doo=datetime.date.today()

def enter(self):

self.ano=ct.next()

self.cname=string(input("Enter the Customer Name"))

self.addr=input("Enter the Customer Address")

self.phno=fixed(input("Enter the Customer Phone no."),10)

self.atype=acct_type(input("Enter the Type of Account [S-Saving,C-


Current]"))

self.bal=balance(input("Enter the initial Deposit amt:"))

self.doo=datetime.date.today()

def show(self):

print("\nCustomer Details\n")

print("Account No.:",self.ano)

print("\n Customer Name:",self.cname)

print("\n Customer Addr:",self.addr)

print("\n Customer Phone number:",self.phno)

print("\n Account Type:",self.atype)

print("\n Customer Balance:",self.bal)

def modify_cust(self):

if not os.path.isfile(Cfile):

14
Online Banking System
print(Cfile,"does not exist")

else:

cob=open(Cfile,'rb')

tob=open("tempc.dat","ab+")

tcode=input("\n Enter the Account number to update Customer details")

fg=0

try:

while True:

ct=pickle.load(cob)

if (ct.ano==tcode):

print("\nCustomer details\n")

ct.show()

ct.cname=input("Enter new name")

ct.phno=fixed(int(input("Enter the phone no.")),10)

ct.addr=string(input("Enter the Address"))

ct.atype=acct_type(input("Enter the new Account Type"))

pickle.dump(ct,tob)

fg=1

else:

pickle.dump(ct,tob)

except EOFError:

pass

if (fg==0):
15
Online Banking System
print("Account Number",tcode,"not found")

tob.close()

cob.close()

os.remove("cust.dat")

os.rename("tempc.dat","cust.dat")

def delete_cust(self):

if not os.path.isfile(Cfile):

print(Cfile,"does not exist")

else:

cob=open(Cfile,'rb')

tob=open("tempd.dat","ab+")

ct=cust()

tcode=int(input("\n Enter the Account Number to be delete the


Customer"))

fg=0

try:

while True:

ct=pickle.load(cob)

if (ct.ano!=tcode):

pickle.dump(ct,tob)

16
Online Banking System
fg=1

except EOFError:

pass

if (fg==0):

print("Account Number",tcode,"not found")

tob.close()

cob.close()

os.remove("cust.dat")

os.rename("tempd.dat","cust.dat")

#check valid account number

def valid_ano(d):

cob=open(Cfile,'rb')

ct=cust()

fg=0

try:

while True:

ct=pickle.load(cob)

d=int(d)

if (ct.ano==d):

#print "in file account no\n",ct.ano

fg=1
17
Online Banking System
break

cob.close()

except EOFError:

pass

if (fg==1):

return d

else:

print(d," Account no. does not exist")

d=input("Enter the Account No.")

return d

class trans(cust):

def __init__(self,ano=0,atype='',ir=0,tamt=0):

self.ano=ano

self.atype=atype

self.ir=ir

self.tamt=tamt

self.tdate=datetime.date.today()

self.ttype=''

def Withdrawl(self):

tof=open("tempf.dat","ab+")
18
Online Banking System
cob=open(Cfile,'ab+')

tob=open(Tfile,'wb+')

ct=cust()

bt=trans()

fg=0

d=valid_ano(int(input("Enter the Account Number for Withdrawl")))

d=int(d)

try:

while True:

ct=pickle.load(cob)

if (ct.ano==d):

print("in file account no\n",ct.ano)

bt.ttype="Withdraw"

bt.ano=ct.ano

bt.atype=ct.atype

amt=input("Enter Amt to Withdrawed")

diff=ct.bal-amt

print("Difference=",diff)

if (diff>2000):

ct.bal=diff

fg=1

#break

else:
19
Online Banking System
print("Minimum balance below 2000")

amt=numerics(input("Re-enter the amount"))

diff=ct.bal-amt

ct.bal=diff

bt.tdate=datetime.date.today()

bt.tamt=amt

if (ct.atype=='S'):

bt.ir=0.12

else:

bt.ir=0.15

pickle.dump(bt,tob)

pickle.dump(ct,tof)

print("Balance=",diff)

except EOFError:

pass

except ValueError:

pass

tob.close()

cob.close()

tof.close()

os.remove("cust.dat")
20
Online Banking System
os.rename("tempf.dat","cust.dat")

def deposit(self):

tof=open("tempf.dat","ab+")

cob=open(Cfile,'ab+')

tob=open(Tfile,'wb')

ct=cust()

bt=trans()

fg=0

d=valid_ano(int(input("Enter the Account Number for Deposit")))

d=int(d)

try:

while True:

ct=pickle.load(cob)

if (ct.ano==d):

print("in file account no\n",ct.ano)

bt.ttype="Deposit"

bt.ano=ct.ano

bt.atype=ct.atype

amt=int(input("Enter Amt to Withdrawed"))

diff=ct.bal+amt

#print "Amount=",diff
21
Online Banking System
ct.bal=diff

bt.tdate=str(datetime.date.today())

bt.tamt=amt

if (ct.atype=='S'):

bt.ir=0.12

else:

bt.ir=0.15

pickle.dump(bt,tob)

pickle.dump(ct,tof)

print("Balance=",diff)

except EOFError:

pass

except ValueError:

pass

tob.close()

cob.close()

tof.close()

os.remove("cust.dat")

os.rename("tempf.dat","cust.dat")

def bal_enq(self):

print("\nBalance Enquiry\n")
22
Online Banking System
tob=open(Tfile,'rb')

cob=open(Cfile,'rb')

ct=cust()

ts=trans()

fg=0

d=valid_ano(int(input("Enter the Account No to check balance")))

d=int(d)

try:

while True:

ts=pickle.load(tob)

ct=pickle.load(cob)

print("Acct no in Bal Enq is\n ",ts.ano)

if ((d==ts.ano) and (d==ct.ano)):

print("Account type :",ts.atype)

print("Account Current balance :",ct.bal)

print("Transaction Type :",ts.ttype)

break

else:

print(d," Account no. not found")

except EOFError:

pass

tob.close()

23
Online Banking System
def show_trans(self):

tob=open(Tfile,'rb')

ts=trans()

try:

while True:

ts=pickle.load(tob)

print("\nAccount No.:",ts.ano)

print("\nAccount type :",ts.atype)

print("\n Interest rate",ts.ir)

print("\n Transaction Amount",ts.tamt)

print("\n Transaction Date",ts.tdate)

print("\n Transaction Type :",ts.ttype)

except EOFError:

pass

tob.close()

def daily_report(self):

try:

tos=open(Tfile,'rb')

ts=trans()

y=int(input("Enter the year"))

m=int(input("Enter the month as 01/02/so on"))

d=int(input("Enter the date"))


24
Online Banking System
print(" date entered is ",y,"-",m,"-",d)

while True:

ts=pickle.load(tos)

d=str(ts.tdate)

yy=int(d[0:4])

mm=int(d[5:7])

dd=int(d[8:11])

print(" date in sys is ",yy,"-",mm,"-",dd)

if d==dd or y==yy or m==mm:

ts.show_trans()

else:

print("Date doesnt match")

except EOFError:

pass

tos.close()

def monthly_report(self):

try:

tos=open(Tfile,'rb')

ts=trans()

y=str(input("Enter the year"))

m=str(input("Enter the month as 01/02/so on"))


25
Online Banking System
while True:

ts=pickle.load(tos)

d=str(ts.tdate)

yy=str(d[0:4]).strip()

mm=str(d[5:7]).strip()

dd=str(d[8:10]).strip()

print(" date in sys is ",yy,"-",mm,"-",dd)

if ((yy==y) or (mm==m)):

ts.show_trans()

else:

print("Date doesnt match")

except EOFError:

pass

tos.close()

def main():

ce=cust()

te=trans()

while True:

ch=0

print("\nBanking Project\n")

print("Main Menu")
26
Online Banking System
print(" 1. Customer \n 2. Transaction \n 3. Reports\n 4.Exit")

ch=int(input("Enter the Choice"))

if ch==1:

ch1=0

print("\n Customer Menu\n")

print("\n 1. Add New Customer \n 2. Modify Customer Details\n 3. Delete


the Customer\n 4. Main Menu")

ch1=int(input("Enter the Choice from Customer Menu:"))

if ch1==1:

cob=open(Cfile,"ab+")

ca=cust()

try:

ca.enter()

pickle.dump(ca,cob)

except EOFError:

pass

cob.close()

elif ch1==2:

ce.modify_cust()

elif ch1==3:

ce.delete_cust()

27
Online Banking System
elif ch==2:

ch2=0

#print(" \n TRANSACTION MENU\N")

print("\n 1. WithDrawl \n 2. Deposit \n 3. Balance Enquiry \n 4. Show All


Transactions \n 5. Main Menu")

ch2=int(input("Enter the Choice from Transaction Menu:"))

if ch2==1:

print("\n Withdrawl Transaction\n")

te.Withdrawl()

elif ch2==2:

te.deposit()

elif ch2==3:

te.bal_enq()

elif ch2==4:

te.show_trans()

elif ch==3:

ch3=0

print("\n REPORTS\n")

print("\n 1. View Customer Details\n 2. Daily Report\n 3. Monthly Report


\n Main Menu")

ch3=int(input("Enter the Choice from Report Menu:"))

if ch3==1:

try:

28
Online Banking System
cos=open(Cfile,'rb')

cs=cust()

print("Account No.||\t Customer Name||\t Phone No.|| || Address


||Account Balance || Date of Opening || Account Type")

while True:

cs=pickle.load(cos)

print(cs.ano,"||\t\t",cs.cname,"||\t\t",cs.phno,"||\t\t ",cs.addr,"||\t\t
",cs.bal,"||\t",cs.doo,"||\t ",cs.atype)

except EOFError:

pass

cos.close()

elif ch3==2:

te.daily_report()

elif ch3==3:

te.monthly_report()

elif ch3==4:

main()

elif ch==4:

print("End of Project ")

break

main()

29
Online Banking System
OUTPUT SCREENS

30
Online Banking System
31
Online Banking System
32
Online Banking System
33
Online Banking System
34
Online Banking System
35
Online Banking System
36
Online Banking System
BIBLIOGRAPHY
1. Computer Science Textbook
By Sumita Arora

1. Effective Python: 59 Ways to Write Better Python


By Brett Slatkin

2. www.python.org/docs

3. https://www.javatpoint.com/python-tutorial

4. https://www.programiz.com/python-programming/tutorial

5. https://www.tutorialspoint.com/python3/index.htm

37
Online Banking System

Вам также может понравиться