-
Notifications
You must be signed in to change notification settings - Fork 0
/
B28.java
57 lines (50 loc) · 1.26 KB
/
B28.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
interface IEmployee{
int calculate();
String getName();
}
abstract class EMployee implements IEmployee{
private String name;
private int peymentPerHour;
public EMployee(String name,int peymentPerHour){
super();
this.name = name;
this.peymentPerHour = peymentPerHour;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return name;
}
public void setPeymentPerHour(int peymentPerHour) {
this.peymentPerHour = peymentPerHour;
}
public int getPeymentPerHour() {
return peymentPerHour;
}
}
class PartTimeEmployee extends EMployee{
private int workingHours;
public PartTimeEmployee(String name,int peymentPerHour,int workingHours) {
super(name, peymentPerHour);
this.workingHours = workingHours;
}
@Override
public int calculate() {
return workingHours*getPeymentPerHour();
}
}
class FulltimeEmployee extends EMployee{
public FulltimeEmployee(String name,int peymentPerHour){
super(name, peymentPerHour);
}
@Override
public int calculate() {
return 8*getPeymentPerHour();
}
}
public class B28 {
public static void main(String[] args) {
}
}