Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a brief explanation of how this code works as far as the the classes and

ID: 3620206 • Letter: I

Question

I need a brief explanation of how this code works as far as the the classes and how the program executes.

import shelve
import string
import datetime
class Transaction:
DateOfTransaction = datetime.datetime(1900,1,1).today();
TypeOfTransaction = "";
FinalBalance = "";
def __init__(self, TypeOfTransaction,FinalBalance):
self.TypeOfTransaction =TypeOfTransaction;
self.FinalBalance = FinalBalance;
def showTransaction(self):
print str(self.DateOfTransaction) + " "+self.TypeOfTransaction + " " +str(self.FinalBalance);

class Account:
balance = 0.0;
transactions = [];
def __init__(self, balance):
self.balance = balance;
def deposit(self, amt):
self.balance = self.balance + amt
t = Transaction("Deposit",self.balance);
self.transactions.append(t);
print "Balance:" + str(self.balance);
def withdraw(self,amt):
self.balance = self.balance - amt
t = Transaction("Withdraw",self.balance);
self.transactions.append(t);
print "Balance:" + str(self.balance);
def displayTransactions(self):
for key in self.transactions:
key.showTransaction();
def getbalance(self):
return self.balance

foo = Account(10000)
b = 1
print "Welcome to the Petty Cash System!"
print "Primary account balance for an account:10000"
while(b != 3):
print "Please make a selection by typing one of the following options."
print "1.Deposit balance #: 1"
print"2.Withdraw balance #: 2"
print "3.Show transactions #: 3"
print "4.exit the Database type the #: 4"
b = input(':')
if b == 1:
print "Enter the Deposit:"
n = raw_input(':')
foo.deposit(int(n));
if b == 2:
print "Enter the Withdraw:"
n = raw_input(':')
foo.withdraw(int(n));
if b == 3:
foo.displayTransactions();
if b == 4:
break;

Explanation / Answer

Dear user, This is simple bank-traction module in python.The cash system has different options.Those are                  Deposit balance                  Withdraw balance                  Show transactions                   exit the Database This python program shows that primary account balance,date of traction,type of transaction,final balance. I hope this will helps to you

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote