class BankAccount: # BankAccount(string, integer, number) def __init__(self, owner, accountNumber, balance): self.owner = owner self.accountNumber = accountNumber self.balance = balance # __str__: -> string def __str__(self): return self.owner + ": #" + str(self.accountNumber) + ": $" + str(self.balance) # getOwner: -> string def getOwner(self): return self.owner # getAccountNumber: -> integer def getAccountNumber(self): return self.accountNumber # getBalance: -> number def getBalance(self): return self.balance # setOwner: string -> void def setOwner(self, owner): if (owner.strip() != ''): self.owner = owner else: print("Error: can't set the owner to an empty string.") # setAccountNumber: integer -> void def setAccountNumber(self, accountNo): if (accountNo >= 0): self.accountNumber = accountNo else: print("Error: the account number cannot be negative.") # setBalance: number -> void def setBalance(self, balance): if (balance >= 0): self.balance = balance else: print("Error: the balance cannot be negative.") # withdraw: number -> void def withdraw(self, amount): if (amount >= 0.0): if (self.balance >= amount): self.balance = self.balance - amount else: print("Error: not enough balance.") else: print("Error: cannot withdraw a negative amount.") # deposit: number -> void def deposit(self, amount): if (amount >= 0.0): self.balance = self.balance + amount else: print("Error: cannot deposit a negative amount.")