// The manager runs “void seeDanger()” to handle the danger by // gathering information from all supervisors under his management // and execute “void contactBoss()” to inform CEO. public override void seeDanger(AbstractEmployee source, EmployeeIF bossMan) { Console.WriteLine("Manager " + this.name + " becomes aware of danger, gathering information from subordinate supervisors."); gatherInformation(); // and execute “void contactBoss()” to inform CEO. contactBoss(); }
// When a regular employee identifies a danger, // the issue is reported to his/her supervisor or project leader. public override void seeDanger(AbstractEmployee source, EmployeeIF bossMan) { if (this.boss != null) { Console.WriteLine("Regular Employee sees danger, reporting to their boss " + this.boss.getName() + ".\n"); bossMan.seeDanger(this, this.boss); } }
// The supervisor or leader will announce the danger // to his/her direct subordinates and also report it to his/her manager. // Supervisor Jeff always sends Rob and Rick to support the other team // that encounters an incidence, i.e., these two guys perform fixIt() // for the other team. public override void seeDanger(AbstractEmployee source, EmployeeIF bossMan) { Console.WriteLine("Superviser " + this.name + " becomes aware of danger, telling all subordinates to fix it. "); foreach (RegularEmployee subordinate in subordinateList) { subordinate.fixIt(); } notify(); Console.WriteLine("\nSuperviser " + this.name + " informing boss " + this.boss.getName() + " of the danger."); boss.seeDanger(this, boss); }
public override void seeDanger(AbstractEmployee source, EmployeeIF boss) { // The CEO receives one decision from each manager. Console.WriteLine("Collecting the managers decisions: "); foreach (Manager manager in this.subordinateList) { Console.WriteLine("Adding manager " + manager.name + " decision: [" + manager.decision.decisionMade + "] to the decision list."); decisionList.Add(manager.suggestedDecision()); } finalDecision = grant(decisionList); Console.WriteLine("The CEO's final decision is: [" + finalDecision.decisionMade + "]"); // The evacuation is broadcasted from CEO to all employees and the // evacuation procedure must start with regular employees first, // then supervisors and leaders, managers next, and finally the CEO. // Basically, a person’s evacuate() method is called to evacuate and // the method displays “The employee [name] is evacuating”. finalDecision.doIt(this); }
public RegularEmployee(string regularName, EmployeeIF regularBoss) { this.name = regularName; this.boss = regularBoss; }
public abstract override void seeDanger(AbstractEmployee source, EmployeeIF boss);
public CEO(string ceoName, EmployeeIF ceoBoss) { this.name = ceoName; this.boss = ceoBoss; }
// The supervisor runs “void seeDanger()” to tell all his subordinates // to perform fixIt() and also informs his manager. // The supervisor or leader will announce the danger // to his/her direct subordinates and also report it to his/her manager. public Supervisor(string supervisorName, EmployeeIF supervisorBoss) { this.name = supervisorName; this.boss = supervisorBoss; }
public Manager(string managerName, EmployeeIF managerBoss) { this.name = managerName; this.boss = managerBoss; }
public ProjectLeader(string projectLeaderName, EmployeeIF projectLeaderBoss) { this.name = projectLeaderName; this.boss = projectLeaderBoss; }
// The supervisor or leader will announce the danger // to his/her direct subordinates and also report it to his/her manager. public override void seeDanger(AbstractEmployee source, EmployeeIF bossMan) { Console.WriteLine("Project Leader becomes aware of danger, notifying their boss"); boss.seeDanger(this, boss); }