-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathUsingAbstraction.java
More file actions
48 lines (41 loc) · 892 Bytes
/
UsingAbstraction.java
File metadata and controls
48 lines (41 loc) · 892 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
interface IAccount{
public void withDraw(double amount , int pinCode);
}
class Account implements IAccount{
@Override
public void withDraw(double amount, int pinCode){
if(isAccountExist(pinCode)){
if(isTransactionAvaliable()){
System.out.println("WithDraw Done SuccessFully....");
}
else
{
System.out.println("Transaction is not Avaliable....");
}
}
else{
System.out.println("Invalid PinCode No");
}
}
public boolean isTransactionAvaliable(){
return true;
}
public boolean isAccountExist(int pinCode){
if(pinCode>=1001){
return true;
}
else
{
return false;
}
}
}
public class UsingAbstraction {
public static void main(String[] args) {
// TODO Auto-generated method stub
IAccount account = new Account();
//account.isAccountExist(1002);
//account.isTransactionAvaliable();
account.withDraw(9999, 1003);
}
}