-
Notifications
You must be signed in to change notification settings - Fork 0
/
Account.py
82 lines (57 loc) · 2.05 KB
/
Account.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import string
import random
class Account:
name = ""
_password = ""
_accountBalance = 0
_accountID = 0
_accountRouter = 0
def __init__(self, name,password):
self._name = name
self._password = password
self._accountBalance = 0
self.__accountID = "".join(random.choices(string.ascii_uppercase +string.digits, k = 9))
self.accountRouter = 12510165
def returnName(self):
return self._name
def changeName(self, password):
status = 0
if (self.password != password):
print("Unable to change name, wrong password")
else:
self._name = input(str("New name:"))
status = 1
return status
def changePassword(self, password):
status = 0
if (self._password != password):
return status
else:
self._password = input(str("New passowrd:"))
status =1
return status
def withdrawMoney(self,amount):
status = False
if self._accountBalance >= amount:
self._accountBalance =- amount
status = True
return status
def depositMoney(self, amount):
self._accountBalance += amount
return True
class SavingsAccount(Account):
interestRate = 0
def __init__(self, name, password, interest):
super().__init__(name, password)
self.Yearlybonus = 0.05
self.interestRate = interest
def monthInterestRate(self):
self._accountBalance += (self._accountBalance * self.interestRate)
def yearlyInterestRate(self):
for i in range(1, 12):
self._accountBalance = self._accountBalance + (self._accountBalance * self.interestRate)
self._accountBalance = self._accountBalance + (self._accountBalance * (self.interestRate + 1))
print(self._accountBalance)
def fiveYearGrowth(self):
for i in range(1, 60):
self._accountBalance = self._accountBalance + (self._accountBalance * self.interestRate)