stimulate an atm machine. (Game: ATM machine) Use the Account class created in Exercise 7.3 to simulate an ATM machine. Create ten accounts in a list with the ids: 0, 1..., 9, and an initial balance of $100.00. The system prompts the user to enter an id. If the id is entered incorrectly, ask the user to enter a correct id. Once an id is accepted, the main menu is displayed as shown in the sample run. You can enter a choice of 1 for viewing the current balance, 2 for withdrawing money, 3 for depositing money, and 4 for exiting the main menu. Once you exit, the system will prompt for an id again. So, once the system starts, it won't stop.
so this is my code and I'm getting a syntax error
so this is my code and I'm getting a syntax error
class Account:
def _init_(self, dateCreated,bank_id = 0, balance = 0.0, annualInterestRate = 0,0): <- I get a syntax error here
self.bank_id = bank_id
self.balance = balance
self.annualInterestRate = annualInterestRate
self.dateCreated = dateCreated
def createAccount(self):
Account('00-00-0000', 0, 0.0, 0.0)
print("Default account instance is created")
def createAccountwithvals(self, spec_id, ini_bal):
Account(self.dateCreated, spec_id, ini_bal, self.annualInterestRate)
print("Account is created with id " + str(spec_id) + " and with a balance of " + str(ini_bal))
def getid(self):
return self.bank_id
def setid(self,val):
self.bank)id = val
def getbalance(self):
return self.balance
def setbalance(self, val):
self.balance = val
def getannualInterestRate(self):
return self.annualInterestRate
def setannualInterestRate(self,val):
self.annualInterestRate = val
def getdateCreated(self):
return self.dateCreated
def getMonthlyInterestRate(self):
return (self.annualInterestRate/12)
def withdraw(self, val):
print("balance before withdrawl", self.balance)
self.balance= self.balance - val
print("balance after withdrawl", self.balance)
def deposit(self, val):
print("Balance before deposit", self.balance)
self.balance = self.balance + val
print("Balance after deposity", self.balance)
if __name__ == '__main__':
x = Account('3-2-2017', 1122, 20000, 4.5)
x.withdraw(2500)
x.deposit(3000)
x.createAccountwithvals(2222, 15000)
