Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Manager{
- private String name;
- //create Manager object by providing name
- Manager(String managerName ){
- this.name = managerName;
- }
- //only manager can change his name
- private void changeName(String managerName){
- this.name = managerName;
- }
- //manager can fire any selected Employee
- public void fireEmployee(Employee emp){
- emp.changeWorkStat(false);
- }
- }
- /* --------------------------- */
- class Employee{
- private String name;
- private String designation;
- private boolean workStat;
- Employee(String name ,String designation ){
- this.designation = designation;
- this.name = name;
- this.workStat = true;
- }
- //only Employee can change his name
- private void changeName(String empName){
- this.name = empName;
- }
- //to fire the employee manager can execute this method
- public void changeWorkStat(boolean stat){
- this.workStat = stat;
- }
- }
- class Manager { /* ... personal data ... */ }
- class Employee { /* ... personal data ... */ }
- class StaffRegistry
- {
- void hire(Manager supervisor, Employee employee, Designation designation) { /* ... */ }
- void fire(Manager supervisor, Employee employee) { /* ... */ }
- boolean isEmployed(Employee employee) { /* ... */ }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement