-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathD4-1.txt
43 lines (39 loc) · 1.12 KB
/
D4-1.txt
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
abstract class Branch{
public abstract boolean validatePhotoProof(String proof);
public abstract boolean validateAddressProof(String proof);
public void openAccount(String photoProof,String addressProof,int amount){
if(amount>=1000){
if(validateAddressProof(addressProof) && validatePhotoProof(photoProof)){
System.out.println("Account opened");
}
else{
System.out.println("cannot open account");
}
}
else{
System.out.println("cannot open account");
}
}
}
class MumbaiBranch extends Branch{
public boolean validatePhotoProof(String proof){
if(proof.equalsIgnoreCase("pan card")){
return true;
}
return false;
}
public boolean validateAddressProof(String proof){
if(proof.equalsIgnoreCase("ration card")){
return true;
}
return false;
}
}
class Execute{
public static void main(String[] args){
Branch mumbaiBranch=new MumbaiBranch();
mumbaiBranch.openAccount("pan card","ration card",2000);
}
}
Output:
Account opened