forked from abhaysamantni/Python_OOP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccount_test.py
More file actions
33 lines (25 loc) · 915 Bytes
/
Copy pathaccount_test.py
File metadata and controls
33 lines (25 loc) · 915 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
32
33
# This program demonstrates the BankAccount class.
import bankaccount
def main():
# Get the starting balance.
#start_bal = float(input('Enter your starting balance: '))
# Create a BankAccount object.
savings = bankaccount.BankAccount()
# 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('Your account balance is $', \
format(savings.get_balance(), ',.2f'),
sep='')
# 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('Your account balance is $', \
format(savings.get_balance(), ',.2f'),
sep='')
# Call the main function.
main()