-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlay2.java
More file actions
42 lines (38 loc) · 1.25 KB
/
Copy pathPlay2.java
File metadata and controls
42 lines (38 loc) · 1.25 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import java.util.*;
public class Play2 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("enter user Type:(1:TERM DEPOSIT 2: RECURRING DEPOSIT)");
int btype = sc.nextInt();
while(btype != 1 && btype != 2){
System.out.println("input valid:");
btype = sc.nextInt();
}
if(btype ==1){
System.out.println("TERM DEPOSIT USER ! WELCOME");
}
else{
System.out.println("RECURIING DEPOSIT USER ! WELCOME");
}
System.out.println("enter principal amount:");
long p = sc.nextLong();
System.out.println("enter rate:");
float rate = sc.nextFloat();
System.out.println("enter time period:");
int t = sc.nextInt();
double a = 0;
switch(btype){
case 1:
double temp = Math.pow((1+rate/100.0),t);
a = p*temp;
break;
case 2:
a = (p*t)+((p*t*(t+1))/2.0*(rate/100.0)*(1.0/12.0));
break;
default:
break;
}
System.out.println("amount for given data is:"+a);
sc.close();
}
}