July project night/OO lesson/mainProgram2.py

import banking2 as banking

theBank = banking.Bank userAnna = banking.User("Anna","myPassword") print "Main program created the user " + userAnna.username theBank.addUser(userAnna)

isLoggedIn = theBank.logIn(userAnna.username, userAnna.password) if isLoggedIn: accountAnna = banking.Account(userAnna) print "Main program created an account for " + accountAnna.user.username accountAnna.addMoney(10) isLoggedIn = theBank.logIn(userAnna.username, "bad password") if isLoggedIn: accountAnna.withdrawMoney(accountAnna.balance) else: print "Bad user! No moneys for you."