0
Can anyone please define me this hierarchy? How to solve this?
Create the following OOP class hierarchy:Â ï· Person â general class for anyone, holding id, first name and last name. o Employee â general class for all employees, holding the field salary and department. The department can only be one of the following: Production, Accounting, Sales or Marketing.Â ï§ Manager â holds a set of employees under his command.Â ï§ RegularEmployee - SalesEmployee â holds a set of sales. A sale holds product name, date and price. - Developer â holds a set of projects. A project hold
1 Answer
0
abstract class Person {
private int id;
private String firstName;
private String lastName;
}
public class Employee extends Person {
private Double salary;
private Department department;
}
public class Manager {
private ArrayList<Employee> employees;
}
public enum Department {
PRODUCTION,
ACCOUNTING,
SALES,
MARKETING
}
abstract class RegularEmployee {
}
public class SalesEmployee extends RegularEmployee {
private String productName;
private Date date;
private Double price;
}
public class Developer extends RegularEmployee {
private ArrayList<Project> projects;
}
public class Project {
}