I have tweaked this program but not sure additions I made are correct and also need some help in making some additions. I want to make sure the program can track the dates of all the types of transactions within the program also having a loop involved so someon can continue to make addition type transactions. I want this program also to be able for a person to use a username or some sort of ID then have it be able to email the person their details of transactions. Any ideas how to incorporate this?
class Petty:
def __init__(self, initial):
self.balance = initial
def deposit(self, amt):
self.balance = self.balance + amt
def withdraw(self, amt):
self.balance = self.balance - amt
def getbalance(self):
return self.balance
a = Petty(0)
tlist = ['Report of Account Activity']
from time import localtime, strftime
print 'Welcome to the Cash Petty Fund!'
print
while True:
print 'Please enter the number to perform an action'
print
print '1 - Deposit money'
print '2 - Withdraw money'
print '3 - Get the Account Balance'
print '4 - Get Account Report'
print '5 - Exit'
print
sel = raw_input("Selection: ")
if sel == '1':
print
dep = input('Enter amount deposited: ')
a.deposit(dep)
t = strftime("%a, %d %b %Y %H:%M:%S", localtime())
trans = '$%.2f deposited on %s' % (dep, t)
tlist.append(trans)
print 'New balance is: $%.2f' % a.getbalance()
print
if sel == '2':
print
wd = input('Enter amount withdrawn: ')
a.withdraw(wd)
t = strftime("%a, %d %b %Y %H:%M:%S", localtime())
trans = '$%.2f withdrawn on %s' % (wd, t)
tlist.append(trans)
print 'New Balance is: $%.2f' % a.getbalance()
print
if sel == '3':
t = strftime("%a, %d %b %Y %H:%M:%S", localtime())
print 'Current balance as of %s is: $%.2f' % (t,a.getbalance())
if sel == '4':
print
for number in range(0, len(tlist)):
print tlist[number]
print
print 'Current balance is $%.2f' % a.getbalance()
print
if sel == '5':
print 'Closing will result in loss of all information.'
sure = raw_input('Are you sure? (y/n) ')
if sure == 'y':
print 'The current balance is $%.2f' % a.getbalance()
print 'Remember this balance to keep the program accurate for the next launch'
break
else:
print 'Continuing with program'
print
print