Extending our interest calculator
No. 103
Q: |
Our current Extend the current project by adding a new class
variable CautionDo not forget to change the Javadoc comments accordingly! |
A: |
We introduce a new variable
We need the appropriate getter and setter methods in
The computed interest depends on positive or negative balance values:
Using Math.pow() for calculating e.g. rather than using a loop is actually a bad idea: Math.pow() internally using a power series expansion is expensive with respect to execution performance. Due to the integer exponential value a simple loop involving only multiplications offers a better choice. |