-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank.java
82 lines (76 loc) · 1.71 KB
/
Bank.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
import java.io.*;
import java.util.*;
class Bank
{
float getRateOfInterest()
{
return 0;
}
}
class SBI extends Bank
{
float getRateOfInterest()
{
return 8.4f;
}
}
class ICICI extends Bank
{
float getRateOfInterest()
{
return 7.3f;
}
}
class AXIS extends Bank
{
float getRateOfInterest()
{
return 9.7f;
}
}
class poly
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String B;
Bank b;
float c;
float d;
float e;
float f;
b=new SBI();
System.out.println("SBI Rate of Interest: "+b.getRateOfInterest());
c= b.getRateOfInterest();
b=new ICICI();
System.out.println("ICICI Rate of Interest: "+b.getRateOfInterest());
d=b.getRateOfInterest();
b=new AXIS();
System.out.println("AXIS Rate of Interest: "+b.getRateOfInterest());
e= b.getRateOfInterest();
System.out.println("Enter the bank name:");
B=sc.next();
System.out.println("Enter the ROI:");
f=sc.nextFloat();
if(f!=c&&f!=d&&f!=e)
{
System.out.println("RATE OF INTEREST IS INVALID");
}
if(B.equals("SBI") && f==c)
{
System.out.println("VALID");
}
if(B.equals("ICICI") && f==d)
{
System.out.println("VALID");
}
if(B.equals("AXIS") && f==e)
{
System.out.println("VALID");
}
if(!B.equals("SBI")&&!B.equals("ICICI")&&!B.equals("AXIS"))
{
System.out.println(" BANK NAME INVALID");
}
}
}