-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
35 lines (28 loc) · 1.08 KB
/
Copy pathmain.py
File metadata and controls
35 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from bank_account import BankAccount
def run_demo():
print("========================================")
print(" SOFTWARE TESTING PROJECT - DEMO ")
print("========================================")
# 1. Account Create
account = BankAccount(owner="Ritika", balance=500.0)
print(f"1. Account Created for: {account.owner}")
print(f" Initial Balance: ${account.balance}\n")
# 2. Deposit
print("2. Depositing $200...")
account.deposit(200.0)
print(f" Updated Balance: ${account.balance}\n")
# 3. Withdraw
print("3. Withdrawing $150...")
account.withdraw(150.0)
print(f" Updated Balance: ${account.balance}\n")
# 4. Error Handling Test (Insufficient Funds)
print("4. Testing Insufficient Funds Error...")
try:
account.withdraw(1000.0)
except Exception as e:
print(f" Caught Expected Error: {e}\n")
print("========================================")
print(" DEMO COMPLETED SUCCESSFULLY! ")
print("========================================")
if __name__ == "__main__":
run_demo()