:hammer: Uplift the function to calculate interest greater than $2000.00 · FagnerMartinsBrack/jack-the-moneylender@408a2cd
View originalCrawl details
- Current
Summary (TL;DR)
This diff shows a code refactoring that extracts a duplicated calculation into a reusable function named calculateInterestForGreaterThan2000. The function computes interest for loan amounts above $2000 by subtracting the threshold from the loan and multiplying by a cents rate. It is then called in three conditional branches handling different loan tiers, replacing inline calculations. The change improves code maintainability and reduces duplication.
@@ -7,6 +7,12 @@ | |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
@@ -18,20 +24,14 @@ | |||
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
@@ -44,8 +44,7 @@ | |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |