-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSavingsAccount.py
46 lines (40 loc) · 1.07 KB
/
SavingsAccount.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
class SavingsAccount:
"""
A class to represent a saving account.
...
Attributes
----------
balance : int
how much money in the saving account
Methods
-------
updateBalance(amount):
updates the saving account balance.
getBalance():
returns the balance in this account
"""
def __init__(self):
"""
Constructs all the necessary attributes for the SavingAccount object.
"""
self.balance = 0
def updateBalance(self, amount):
"""
Parameters
----------
amount : int
the amount of money we want to add to this account
"""
self.balance += amount
def getBalance(self):
"""
:returns
the balance in this account
"""
return self.balance
def __repr__(self):
"""
:return:
how we want to represent the saving account
"""
return "Savings Account:- "+"Balance: " +str(self.balance)+'\n'