I need to make an object called Accounts that can be used as a banking system. It requires 3 inputs, first name, last name, and initial deposit and 4 member functions: withdraw, deposit, fee and interest. The fee is $20 a month if the amount in the account is less than $100. The interest is 5%.
Just wanted to see if I was headed in the right direction, so here's what I've got so far.
class Accounts(object): def __init__(self, first, last, dep=0): self.first = first self.last = last self.dep = dep def deposit(self, amount): self.dep += amount return self.dep def withdraw(self, amount): if amount <= self.dep: self.dep -= amount return True else: return False def fee(self, amount): if self.dep - amount < 1000: self.dep -= (amount + 10) return self.dep def interest(self): return self.dep * 0.3 def final(self): s = Accounts("John", "Doe", 1500) print ("%s, %s, balance: %s") % self.first, self.last, self.dep
Also, I'm using Python 3.3.
Edited by kxjakkk