MainProgram2.py

From OpenHatch wiki
Jump to navigation Jump to search
   from banking2 import *
   the_bank = Bank()
   user_anna = User("Anna","myPassword")
   print "Main program created the user " + user_anna.username
   the_bank.add_user(user_anna)
   is_logged_in = the_bank.login(user_anna.username, user_anna.password)
   if is_logged_in:
       account_anna = Account(user_anna)
       print "Main program created an account for " + account_anna.user.username
       account_anna.add_money(10)
   is_logged_in = the_bank.login(user_anna.username, "bad password")
   if is_logged_in:
       account_anna.withdraw_money(account_anna.balance)
   else:
       print "Bad user! No moneys for you."