Пример #1
0
        private string getWorkerbeeStatusAndReport(worker theWorker, int workerNum)
        {
            string report = "";

            if (!string.IsNullOrEmpty(theWorker.CurrentJob))
            {
                switch (theWorker.ShiftsLeft)
                {
                case 1:
                    report = "Worker #" + workerNum + " will be done with '" + theWorker.CurrentJob
                             + "' after this shift\r\n";
                    break;

                default:
                    report = "Worker #" + workerNum + " is doing '" + theWorker.CurrentJob + "' for "
                             + theWorker.ShiftsLeft + " more shifts\r\n";
                    break;
                }
            }
            else//if (string.IsNullOrEmpty(theWorker.CurrentJob))
            {
                report += "Worker #" + workerNum + " is not working\r\n";
            }

            return(report);
        }
Пример #2
0
 public Queen(worker[] workers)
 {
     //creat the queen's worker bees
     this.workers = new worker[workers.Length];
     this.workers = workers;
     // initialize some private value;
     shiftsNumber = 0;
 }
Пример #3
0
        public Form1()
        {
            InitializeComponent();
            worker[] myworkers = new worker[4];
            /*
            job list:
            Nectar collector
            Egg care
            Hive maintenance
            Baby bee tutoring
            Honey manufacturing
            Sting patrol*/

            myworkers[0] = new worker(new string[] { "Nectar collector", "Honey manufacturing"});
            myworkers[1] = new worker(new string[] { "Egg care", "Baby bee tutoring"});
            myworkers[2] = new worker(new string[] { "Hive maintenance", "Sting patrol" });
            myworkers[3] = new worker(new string[] {"Nectar collector", "Honey manufacturing", "Egg care",
                           "Baby bee tutoring", "Hive maintenance", "Sting patrol"});

            myQueen = new Queen(myworkers);
        }
Пример #4
0
        public Form1()
        {
            InitializeComponent();
            worker[] myworkers = new worker[4];

            /*
             * job list:
             * Nectar collector
             * Egg care
             * Hive maintenance
             * Baby bee tutoring
             * Honey manufacturing
             * Sting patrol*/

            myworkers[0] = new worker(new string[] { "Nectar collector", "Honey manufacturing" });
            myworkers[1] = new worker(new string[] { "Egg care", "Baby bee tutoring" });
            myworkers[2] = new worker(new string[] { "Hive maintenance", "Sting patrol" });
            myworkers[3] = new worker(new string[] { "Nectar collector", "Honey manufacturing", "Egg care",
                                                     "Baby bee tutoring", "Hive maintenance", "Sting patrol" });

            myQueen = new Queen(myworkers);
        }
Пример #5
0
        private string getWorkerbeeStatusAndReport(worker theWorker, int workerNum)
        {
            string report = "";
              if (!string.IsNullOrEmpty(theWorker.CurrentJob))
              {
               switch (theWorker.ShiftsLeft)
               {
                   case 1:
                       report = "Worker #" + workerNum + " will be done with '" + theWorker.CurrentJob
                           + "' after this shift\r\n";
                       break;
                  default:
                       report = "Worker #" + workerNum + " is doing '" + theWorker.CurrentJob + "' for "
                        + theWorker.ShiftsLeft + " more shifts\r\n";
                       break;
               }
               }
              else//if (string.IsNullOrEmpty(theWorker.CurrentJob))
               {
               report += "Worker #" + workerNum + " is not working\r\n";
               }

               return report;
        }