forked from abhaysamantni/Python_OOP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_test2.py
More file actions
31 lines (23 loc) · 832 Bytes
/
account_test2.py
File metadata and controls
31 lines (23 loc) · 832 Bytes
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
# This program demonstrates the BankAccount class
# with the __str__ method added to it.
import bankaccount2
def main():
# Get the starting balance.
start_bal = float(input('Enter your starting balance: '))
# Create a BankAccount object.
savings = bankaccount2.BankAccount(start_bal)
print(savings.balance)
# Deposit the user's paycheck.
pay = float(input('How much were you paid this week? '))
print('I will deposit that into your account.')
savings.deposit(pay)
# Display the balance.
print(savings.balance)
# Get the amount to withdraw.
cash = float(input('How much would you like to withdraw? '))
print('I will withdraw that from your account.')
savings.withdraw(cash)
# Display the balance.
print(savings.balance)
# Call the main function.
main()