-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDRYExample.java
More file actions
24 lines (21 loc) · 813 Bytes
/
DRYExample.java
File metadata and controls
24 lines (21 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.upGrad;
public class DRYExample {
public static int getFinalAmount(int rate, int time, int principal){
int interest = rate * time * principal;
int total = principal + interest;
return total;
}
public static double calculateLateFine(int rate, int time, int principal){
int interest = rate * time * principal;
int total = principal + interest;
double lateFine = 0.1 * total;
return lateFine;
}
public static double calculateEarlyClosingFees(int rate, int time, int principal, int amountPaid){
int interst = rate * time * principal;
int total = principal + interst;
int remainAmount = total - amountPaid;
double closingFee = remainAmount + ( 0.1 * interst);
return closingFee;
}
}