- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompany.java
More file actions
Latest commit
47 lines (41 loc) · 1.39 KB
/
Copy pathCompany.java
File metadata and controls
47 lines (41 loc) · 1.39 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
classMember {
privateStringname;
privateintage;
privateStringphoneNumber;
privateStringaddress;
privatedoublesalary;
publicMember(Stringname, intage, StringphoneNumber, Stringaddress, doublesalary) {
this.name = name;
this.age = age;
this.phoneNumber = phoneNumber;
this.address = address;
this.salary = salary;
}
publicvoidprintSalary() {
System.out.println("Salary " + salary);
}
}
classEmployeeextendsMember {
privateStringspecialization;
publicEmployee(Stringname, intage, StringphoneNumber,
Stringaddress, doublesalary, Stringspecialization) {
super(name, age, phoneNumber, address, salary);
this.specialization = specialization;
}
}
classManagerextendsMember{
privateStringdepartment;
publicManager(Stringname, intage, StringphoneNumber,
Stringaddress, doublesalary, Stringdepartment) {
super(name, age, phoneNumber, address, salary);
this.department = department;
}
}
publicclassCompany {
publicstaticvoidmain(String[] args) {
Employeeemployee = newEmployee("Tom", 25, "555-555-55", "Home", 25631.5, "IT");
Managermanager = newManager("Ron", 30, "555-617-55", "Earth", 69586.5, "IT");
employee.printSalary();
manager.printSalary();
}
}