-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.java
More file actions
80 lines (68 loc) · 2.45 KB
/
manager.java
File metadata and controls
80 lines (68 loc) · 2.45 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
package a;
public class Office {
public static void main(String[] args) {
Manager manager = new Manager("Ron", 30, "94465", "India", 75000.5, "IT", "Robotics");
manager.display();
manager.printSalary();
Officer officer = new Officer("Jose", 19, "94465", "India", 7125000.55, "CS", "IoT");
officer.display();
officer.printSalary();
}
}
class Employee {
protected String name;
protected int age;
protected String phoneNumber;
protected String address;
private double salary;
Employee(String name, int age, String phoneNumber, String address, double salary) {
this.name = name;
this.age = age;
this.phoneNumber = phoneNumber;
this.address = address;
this.salary = salary;
}
public void printSalary() {
System.out.println("Salary " + salary);
}
}
class Officer extends Employee{
private String department;
private String specialization;
Officer(String name, int age, String phoneNumber,
String address, double salary, String department, String specialization) {
super(name, age, phoneNumber, address, salary);
this.department = department;
this.specialization = specialization;
}
public void display() {
System.out.println();
System.out.println("---Officer---");
System.out.println("Name : " + name);
System.out.println("Age : " + age);
System.out.println("department : " + department);
System.out.println("specialization : " + specialization);
System.out.println("Phone Number : " + phoneNumber);
System.out.println("Address : " + address);
}
}
class Manager extends Employee{
private String department;
private String specialization;
Manager(String name, int age, String phoneNumber,
String address, double salary, String department, String specialization) {
super(name, age, phoneNumber, address, salary);
this.department = department;
this.specialization = specialization;
}
public void display() {
System.out.println();
System.out.println("---Manager---");
System.out.println("Name : " + name);
System.out.println("Age : " + age);
System.out.println("department : " + department);
System.out.println("specialization : " + specialization);
System.out.println("Phone Number : " + phoneNumber);
System.out.println("Address : " + address);
}
}