1 | <?php |
||
16 | class SimpleInterestCalculator extends CalculatorAbstract |
||
17 | { |
||
18 | // amount of principal = 'P' |
||
19 | protected $principal; |
||
20 | // annual interest rate = 'i' |
||
21 | protected $annualInterestRate; |
||
22 | // the time, which converted to years = 't' |
||
23 | /** @var TimeSpan */ |
||
24 | protected $time; |
||
25 | |||
26 | /** |
||
27 | * @param $principal |
||
28 | * @param $annualInterestRate |
||
29 | * @param TimeSpan $time |
||
30 | */ |
||
31 | public function __construct( |
||
40 | |||
41 | /** |
||
42 | * @param $principal |
||
43 | */ |
||
44 | public function setPrincipal($principal) |
||
48 | |||
49 | /** |
||
50 | * @param $annualInterestRate |
||
51 | */ |
||
52 | public function setAnnualInterestRate($annualInterestRate) |
||
56 | |||
57 | /** |
||
58 | * @param TimeSpan $time |
||
59 | */ |
||
60 | public function setTime(TimeSpan $time) |
||
64 | |||
65 | /** |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getPrincipal() |
||
72 | |||
73 | /** |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getAnnualInterestRate() |
||
80 | |||
81 | /** |
||
82 | * @return TimeSpan |
||
83 | */ |
||
84 | public function getTime() |
||
88 | |||
89 | /** |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getTimeInYears() |
||
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | public function getTimeInMonths() |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getTimeInDays() |
||
112 | |||
113 | /** |
||
114 | * @return string |
||
115 | */ |
||
116 | public function getInterestNumber() |
||
126 | |||
127 | /** |
||
128 | * @return string |
||
129 | * @throws Exception |
||
130 | */ |
||
131 | public function getInterestDivisor() |
||
141 | |||
142 | /** |
||
143 | * @return string |
||
144 | */ |
||
145 | public function getInterestAmount() |
||
153 | } |
||
154 | } |
||
155 |