Ejemplo n.º 1
0
 // 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();
 }
Ejemplo n.º 2
0
 // 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);
     }
 }
Ejemplo n.º 3
0
        // 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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public RegularEmployee(string regularName, EmployeeIF regularBoss)
 {
     this.name = regularName;
     this.boss = regularBoss;
 }
Ejemplo n.º 6
0
 public abstract override void seeDanger(AbstractEmployee source, EmployeeIF boss);
Ejemplo n.º 7
0
 public CEO(string ceoName, EmployeeIF ceoBoss)
 {
     this.name = ceoName;
     this.boss = ceoBoss;
 }
Ejemplo n.º 8
0
 // 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;
 }
Ejemplo n.º 9
0
 public Manager(string managerName, EmployeeIF managerBoss)
 {
     this.name = managerName;
     this.boss = managerBoss;
 }
Ejemplo n.º 10
0
 public ProjectLeader(string projectLeaderName, EmployeeIF projectLeaderBoss)
 {
     this.name = projectLeaderName;
     this.boss = projectLeaderBoss;
 }
Ejemplo n.º 11
0
 // 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);
 }