-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculate.java
87 lines (87 loc) · 2.48 KB
/
Calculate.java
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
public class Calculate extends Input
{
static double tam[],sum;
public Calculate()throws myexception
{
super();
tam=new double[num];
sum=0;
}
public void store()
{
for(int i=0;i<num;i++)
{
if(type[i].equalsIgnoreCase("savings"))
{
tam[i]=inmoney[i]*Math.pow(1+(7/100.0),time[i]);
}
else if(type[i].equalsIgnoreCase("fix deposit"))
{
tam[i]=inmoney[i]*Math.pow(1+(11/100.0),time[i]);
}
else if(type[i].equalsIgnoreCase("recurring deposit"))
{
tam[i]=inmoney[i]*time[i]*12.0+inmoney[i]*time[i]*12*(time[i]*12+1)*5.0/2400.0;
}
sum+=tam[i];
}
}
public void acNo(String a,long b)throws myexception
{
boolean flag=false;
int i=0;
OUTER_LOOP:
for(i=0;i<num;i++)
{
if(name[i].equalsIgnoreCase(a))
{
flag=true;
break OUTER_LOOP;
}
}
if(flag==true&&phone[i]!=b)
throw new myexception("wrong details");
else if(flag==false)
throw new myexception("name not found");
System.out.println("Account number="+acn[i]);
}
public void acNo(String a)throws myexception
{
boolean flag=false;
int i=0;
OUTER_LOOP:
for(i=0;i<num;i++)
{
if(name[i].equalsIgnoreCase(a))
{
flag=true;
break OUTER_LOOP;
}
}
System.out.println("Account number="+acn[i]);
}
public void information(String a,int b,double tam)throws myexception
{
boolean flag=false;
int i=0;
OUTER_LOOP:
for(i=0;i<num;i++)
{
if(name[i].equalsIgnoreCase(a))
{
flag=true;
break OUTER_LOOP;
}
}
if(flag==true&&acn[i]!=b)
throw new myexception("name not found");
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("Name:"+name[i]+"\nAccount Number:"+b+"\nCurrent Balance:"+tam);
System.out.println("--------------------------------------------------------------------------------------");
}
protected static void mainCal()throws myexception
{
Calculate ob=new Calculate();
ob.store();
}
}