Lab Python 03
Lab Python 03
Exercise #04
Design a Python program that models a banking system using encapsula on and
inheritance. Define a class Account with private a ributes id, balance, and annual
rate. The class includes methods such as deposit(amount) and withdraw(amount)
to modify the balance. Two subclasses, SavingsAccount and CheckingAccount,
inherit from Account. SavingsAccount restricts withdrawals if the balance falls
below a minimum threshold, while CheckingAccount allows overdra s up to a
predefined limit. Outside the class defini ons, create an Account object with an ID
of 1122, a balance of $20,000, and an interest rate of 4.5%. Perform a withdrawal
of $2,500, a deposit of $3,000, and print the final balance.