# CreditBankAccount classes ######################################################### # A sample comment. All comments start with #. # Importing the classes we will use # Format is: from <file name without .py> import <class name> from BankAccount import BankAccount from JointBankAccount import JointBankAccount from CreditBankAccount import CreditBankAccount # Create a BankAccount object and do a few transactions # Notice "try/except" statement to handle exceptions raised basicAccount = BankAccount("Sam Smith", 0) print("At creation : " + basicAccount.toString()) basicAccount.deposit(100) print("After deposit 100: " + basicAccount.toString()) basicAccount.withdraw(50) print("After withdraw 50: " + basicAccount.toString()) try: basicAccount.withdraw(75) print("After withdraw 75: " + basicAccount.toString()) except Exception as ex: print("Failed to withdraw 75: " + str(ex)) # Create a JointBankAccount account and do a few transactions
# Class: 1321L # Sec: 02 # Lab: Python # Term: Fall 2018 # Instructor: Malcolm # Name: Ly Pham from BankAccount import BankAccount myObject = BankAccount() myObject.setID(123456) myObject.setbalance(10000) myObject.withdraw(3500) myObject.deposit(500) myObject.setannualInterestRate(2.50) print(myObject.toString())
# CreditBankAccount classes ######################################################### # Insert new line here # Importing the classes we will use # Format is: from <file name without .py> import <class name> from BankAccount import BankAccount from JointBankAccount import JointBankAccount from CreditBankAccount import CreditBankAccount # Create a BankAccount object and do a few transactions # Notice "try/except" statement to handle exceptions raised basicAccount = BankAccount("Sam Smith", 0) print("At creation : " + basicAccount.toString()) basicAccount.deposit(100) print("After deposit 100: " + basicAccount.toString()) basicAccount.withdraw(50) print("After withdraw 50: " + basicAccount.toString()) try: basicAccount.withdraw(75) print("After withdraw 75: " + basicAccount.toString()) except Exception as ex: print("Failed to withdraw 75: " + str(ex)) # Create a JointBankAccount account and do a few transactions