MainProgram4.py

From OpenHatch wiki
Jump to navigation Jump to search
   import banking4 as banking
   the_bank = banking.Bank()
   user_anna = the_bank.add_user("Anna","myPassword")
   user_jessica = the_bank.add_user("Jessica","jesstess")
   is_logged_in = the_bank.login(user_anna.username, user_anna.password)
   if is_logged_in:
       user_anna.account.add_money(10)
   
   is_logged_in = the_bank.login(user_jessica.username, user_jessica.password)
   if is_logged_in:
       user_jessica.account.add_money(20)
   the_bank.print_accounts()
   the_bank.transfer_money(5, user_jessica, user_anna)
   the_bank.print_accounts()
   the_bank.transfer_money(20, user_anna, user_jessica)
   the_bank.print_accounts()