Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Science
Practical Record File
(Session 2019-2020)
import datetime
import os
def autogen():
x=101
if os.path.isfile('bank.dat')==True:
fp=open('bank.dat','rb')
try:
while True:
a=load(fp)
x+=1
except EOFError:
pass
return x
class mainaf():
def __init__(self):
self.acname=''
self.acno=0
self.actype=''
self.acdate=''
self.acaddr1=''
self.acaddr2=''
self.accity=''
self.bal=0
self.pasw=''
self.hint=''
def getdata(self):
print()
self.acno=autogen()
print()
print()
self.acdate=datetime.date.today()
print ('Date:',self.acdate)
print()
print()
print()
print()
print()
print()
self.hint=self.pasw[::-1]
print()
def dispd(self):
print()
def addacc():
a=mainaf()
fp=open('bank.dat','ab')
a.getdata()
dump(a,fp)
fp.flush()
fp.close()
print()
print()
print("-*"*62)
print()
def dispacc():
fp=open('bank.dat','rb')
try:
while True:
a=load(fp)
a.dispd()
except EOFError:
pass
fp.close()
def delacc():
fp1=open('bank.dat','rb')
fp2=open('temp.dat','wb')
print()
try:
while True:
a=load(fp1)
if a.acno==ano:
fp2.flush()
else:
dump(a,fp2)
except EOFError:
pass
fp1.close()
fp2.close()
os.remove('bank.dat')
os.rename('temp.dat','bank.dat')
print()
print()
print("-*"*62)
print()
def bankserv():
while True:
print()
print()
print()
print()
print()
print()
if skey==1:
addacc()
if skey==2:
dispacc()
if skey==3:
delacc()
if skey==4:
break
print()
print("-*"*62)
class trans():
def __init__(self,na,no,ty,dt,wd,amo,mo):
self.trname=na
self.trno=no
self.trtype=ty
self.trdate=dt
self.trwd=wd
self.tramo=amo
self.trmo=mo
def dispt(self):
print()
print()
print()
def transac():
fp1=open('bank.dat','rb')
fp2=open('temp.dat','wb')
try:
while True:
a=load(fp1)
if a.acno==ano:
print('Hint:',a.hint)
print()
print()
if p==a.pasw:
pass
else:
print()
break
x=a.acname
y=a.actype
z=a.bal
print()
print()
print()
print()
if k=='w':
a.bal-=q
else:
a.bal+=q
print()
print()
print()
print("-*"*62)
,u)
fp=open('trans.dat','ab')
dump(t,fp)
fp.flush()
fp.close()
dump(a,fp2)
else:
dump(a,fp2)
except EOFError:
pass
fp1.close()
fp2.close()
os.remove('bank.dat')
os.rename('temp.dat','bank.dat')
def current():
fp1=open('bank.dat','rb')
print()
try:
while True:
a=load(fp1)
if a.acno==ano:
else:
pass
except EOFError:
pass
fp1.close()
def minis():
fp1=open('trans.dat','rb')
print()
print()
try:
while True:
t=load(fp1)
if t.trno==tno:
t.dispt()
except EOFError:
pass
fp1.close()
fp1=open('bank.dat','rb')
try:
while True:
a=load(fp1)
if a.acno==tno:
print()
print('Closing balance',a.bal)
print()
print("-*"*62)
print()
else:
pass
except EOFError:
pass
fp1.close()
def mini():
while True:
print()
print()
print()
if key==1:
current()
break
if key==2:
minis()
break
print()
print("-*"*62)
print()
def report():
while True:
print()
print()
print('3. RETURN')
print()
if key==1:
dispacc()
if key==2:
mini()
if key==3:
break
print()
print("-*"*62)
print()
def menu():
while True:
print()
print()
print()
print('2. TRANSACTION')
print()
print('3. REPORT')
print()
print('4. EXIT')
print()
print()
print("-*"*62)
if skey==1:
bankserv()
if skey==2:
transac()
if skey==3:
report()
if skey==4:
break
print()
print("-*"*62)
print()
while True:
print()
print()
print('2. EXIT')
print()
print()
print('-*'*62)
if key==1:
menu()
if key==2:
break
Output
============ RESTART: D:\George 12 B C.S\duck bank ( FINAL) 3.py ============
WELCOME TO
_DUCK BANK_
1. MAIN MENU
2. EXIT
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
MAIN MENU
1. BANK SERVICES
2. TRANSACTION
3. REPORT
4. EXIT
1. CREATE ACCOUNT
2. DISPLAY ACCOUNT
3. DELETE ACCOUNT
Date: 2019-10-19
Enter Address 2: Blue Lagoon Apartments, Race course Road, Coimbatore, Flat no: 3A
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. CREATE ACCOUNT
2. DISPLAY ACCOUNT
3. DELETE ACCOUNT
Enter Address 1: Blue Lagoon Apartments, Race course Road, Coimbatore , Flat no:4B
Enter Address 2: Skyline Apartments, M.G. Road, Coimbatore, Flat no: 10F
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. CREATE ACCOUNT
2. DISPLAY ACCOUNT
3. DELETE ACCOUNT
4. RETURN TO MAIN MENU
Account number: 101 Name: George Account type: Savings Balance: 400000 Date: 2019-
10-19
Account number: 102 Name: Avram Account type: Savings Balance: 200000 Date: 2019-10-19
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. CREATE ACCOUNT
2. DISPLAY ACCOUNT
3. DELETE ACCOUNT
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. CREATE ACCOUNT
2. DISPLAY ACCOUNT
3. DELETE ACCOUNT
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
MAIN MENU
1. BANK SERVICES
2. TRANSACTION
3. REPORT
4. EXIT
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
Hint: marva
Name: George
Transaction is complete.
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
MAIN MENU
1. BANK SERVICES
2. TRANSACTION
3. REPORT
4. EXIT
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. ACCOUNT LIST
2. INDIVIDUAL ACCOUNT
3. RETURN
Account number: 101 Name: George Account type: Savings Balance: 388000 Date: 2019-
10-19
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
*-*-*-*-*-*-*-*-*-*
1. ACCOUNT LIST
2. INDIVIDUAL ACCO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