-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM.java
More file actions
45 lines (38 loc) · 787 Bytes
/
ATM.java
File metadata and controls
45 lines (38 loc) · 787 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
public class ATM {
public static void main(String[] args) {
Atmcard a=new Atmcard(100);
Cash c=new Cash(50);
a.checkpin();
a.pay();
c.pay();
}
}
abstract class payment{
double amount;
payment(double amount){
this.amount=amount;
}
abstract void pay();
}
interface Secure {
void checkpin();
}
class Atmcard extends payment implements Secure {
Atmcard(double amount){
super(amount);
}
void pay(){
System.out.println("paying with card ");
}
public void checkpin() {
System.out.println("PIN verified");
}
}
class Cash extends payment{
Cash(double amount){
super(amount);
}
void pay(){
System.out.println("paying with cash" );
}
}