-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram47.java
More file actions
28 lines (25 loc) · 893 Bytes
/
Program47.java
File metadata and controls
28 lines (25 loc) · 893 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
25
26
27
28
class Calculate_Compound_Interest{
double formula(double p, double r, double t){
double CI = p*(Math.pow((1+r/100),t));
return CI;
}
}
class CompoundInterest{
public static void main(String args[]) {
double p;
double r;
double t;
java.util.Scanner Input = new java.util.Scanner(System.in);
//Input the Principal Amount:
System.out.print("Enter principle: ");
p = Input.nextDouble();
System.out.print("\nEnter Rate: ");
r = Input.nextDouble();
System.out.print("\nEnter Time(In Year): ");
t = Input.nextDouble();
System.out.println("Principle is "+p+" , "+"Rate is "+r+" and time is "+t);
Calculate_Compound_Interest CI = new Calculate_Compound_Interest();
double ans = CI.formula(p,r,t);
System.out.println("Compound Interest: "+ans);
}
}