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 Odpowiedź
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 {
}