-
Notifications
You must be signed in to change notification settings - Fork 0
/
Employee.java
59 lines (46 loc) · 1.21 KB
/
Employee.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
58
59
package com.inheritance;
public class Employee extends Person {
String title;
String employer;
char employeeGrade;
double salary;
String surname;
Employee() {
// super(); implicit constructor calling of super class
System.out.println("hello employee");
}
Employee(String SurName, int age) {
super(age);// explicit constructor calling for argumented constructor;
this.surname = SurName;
System.out.println(surname);
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getEmployer() {
return employer;
}
public void setEmployer(String employer) {
this.employer = employer;
}
public char getEmployeeGrade() {
return employeeGrade;
}
public void setEmployeeGrade(char employeeGrade) {
this.employeeGrade = employeeGrade;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
@Override
public String toString() {
return title + " " + employer + " " + employeeGrade + " " + super.getEmail() + " " + super.getName() + " "
+ super.getPhone();// using superkeyword invoke methods from super class
}
}