-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.py
57 lines (45 loc) · 1.32 KB
/
program.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class Account:
def __init__(self, name, startingBalance):
self.name = name
self.balance = startingBalance
# to print the account
def print_account (self):
print("%s $%.2f" % (self.name, self.balance))
# subtracts balance by the withdrawal amount
def withdrawal(self, amount):
self.balance -= amount
return amount
# adds the deposited amount to the balance
def deposit(self, amount):
self.balance += amount
return amount
from Account import Account
test = Account("Jake", 10.0)
another_account = Account("Fred", 1000.0)
print("Balances:")
test.print_account()
another_account.print_account()
# The Menu option
print("1 Print")
print("2 Deposit")
print("3 Withdraw")
print("4 Quit")
line = input("Select option: ")
num = int(line)
if num == 4:
quit
elif num == 1 :
another_account.print_account()
elif num == 2:
deposit_input = input("Amount To Deposit: ")
another_account.deposit(float(deposit_input))
print("New balance:")
another_account.print_account()
elif num == 2:
withdraw_input = input("Amount To Withdraw: ")
another_account.deposit(float(withdraw_input))
print("New balance:")
another_account.print_account()
else :
print("Error occured try Again or enter 4 to quit")
line = input("Select an option: ")