SHARE
TWEET

Untitled

a guest Jun 25th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Manager{
  2.  
  3.     private String name;      
  4.  
  5.  
  6.     //create Manager object by providing name
  7.     Manager(String managerName ){          
  8.         this.name        = managerName;
  9.     }
  10.  
  11.     //only manager can change his name
  12.     private void changeName(String managerName){
  13.         this.name = managerName;
  14.     }
  15.  
  16.  
  17.     //manager can fire any selected Employee
  18.     public void fireEmployee(Employee emp){
  19.         emp.changeWorkStat(false);            
  20.     }  
  21.  
  22.  
  23. }
  24.  
  25. /* --------------------------- */
  26.  
  27.  
  28. class Employee{
  29.     private String name;
  30.     private String designation;
  31.     private boolean workStat;
  32.  
  33.     Employee(String name ,String designation ){
  34.         this.designation     = designation;
  35.         this.name            = name;
  36.         this.workStat        = true;
  37.     }
  38.  
  39.     //only Employee can change his name
  40.     private void changeName(String empName){
  41.         this.name = empName;
  42.     }
  43.  
  44.     //to fire the employee manager can execute this method
  45.     public void changeWorkStat(boolean stat){
  46.         this.workStat = stat;
  47.     }
  48.  
  49. }
  50.      
  51. class Manager { /* ... personal data ... */ }
  52. class Employee { /* ... personal data ... */ }
  53.  
  54. class StaffRegistry
  55. {
  56.     void hire(Manager supervisor, Employee employee, Designation designation) { /* ... */ }
  57.     void fire(Manager supervisor, Employee employee) { /* ... */ }
  58.     boolean isEmployed(Employee employee) { /* ... */ }
  59.     // ...
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top