Repository navigation
Expand file tree
/
Copy pathTaskthree.java
More file actions
97 lines (74 loc) · 2.51 KB
/
Copy pathTaskthree.java
File metadata and controls
97 lines (74 loc) · 2.51 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
class Employee {
protected int empID;
protected String empname;
public Employee(int empID, String empname) {
this.empID = empID;
this.empname = empname;
}
public void displayEmpinfo() {
System.out.println("Employee name is: " + empname);
System.out.println("Employee ID is: " + empID);
}
}
class Manager extends Employee {
private String deptname;
private int teamsize;
public Manager(int empID, String empname, String deptname, int teamsize) {
super(empID, empname);
this.deptname = deptname;
this.teamsize = teamsize;
}
public void displayEmpinfo() {
super.displayEmpinfo();
System.out.println("Department name: " + deptname);
System.out.println("Team size is: " + teamsize);
}
}
class Developer extends Employee {
protected String prolang;
public Developer(int empID, String empname, String prolang) {
super(empID, empname);
this.prolang = prolang;
}
public void displayEmpinfo() {
super.displayEmpinfo();
System.out.println("Using language is: " + prolang);
}
}
class SeniorDev extends Developer {
private int expyear;
public SeniorDev(int empID, String empname, String prolang, int expyear) {
super(empID, empname, prolang);
this.expyear = expyear;
}
public void displayEmpinfo() {
super.displayEmpinfo();
System.out.println("Total experience: " + expyear + " years");
}
}
class JuniorDev extends Developer {
private int trDuration;
public JuniorDev(int empID, String empname, String prolang, int trDuration) {
super(empID, empname, prolang);
this.trDuration = trDuration;
}
public void displayEmpinfo() {
super.displayEmpinfo();
System.out.println("Training duration is: " + trDuration + " months");
}
}
public class Taskthree {
public static void main(String[] args) {
Manager mgr = new Manager(101, "Abol", "IT Infrastructure", 8);
System.out.println("[Manager Information]");
mgr.displayEmpinfo();
System.out.println();
SeniorDev seniorDev = new SeniorDev(102, "Habul", "Java / Spring Boot", 7);
System.out.println("[Senior Developer Information]");
seniorDev.displayEmpinfo();
System.out.println();
JuniorDev juniorDev = new JuniorDev(103, "Kabul", "Python / React", 3);
System.out.println("[Junior Developer Information]");
juniorDev.displayEmpinfo();
}
}