Esempio n. 1
0
		public virtual string Work (House house)
		{//build home 1 рабочий не может строить больше двух частей дома за раз
			for (int i=0; i<house.CountParts; ++i) {
				if (!house [i].IsBuilding) {
					house [i].IsBuilding = true;
					string str = String.Format ("рабочий построил {0}", house [i].ToString ());
					return str;
				}
			}
			return "Рабочий бездельничает\n";
		}
Esempio n. 2
0
        static void Main(string[] args)
        {
            Team team = new Team(300);
            TeamLeader teamLeader = new TeamLeader("Паша");
            House house = new House();
            Console.WriteLine(teamLeader.Work(house));

            for (int i = 0; i < team.Length; ++i)
            {
                team[i].Work(house);
            }
            Console.WriteLine(teamLeader.Work(house));
        }
Esempio n. 3
0
		public override string Work (House house)
		{ //make report
			StringBuilder str = new StringBuilder ();
			for (int i=0; i < house.CountParts; ++i) {
				if (house [i].IsBuilding) {
					str = str.Append (String.Format ("Построен(а) {0}\n", house [i].ToString ()));
				}
			}
			if (str.Length != 0) {
				return str.ToString ();
			} else {
				str.Append ("Ничего не сделано");
				return str.ToString ();
			}
		}
Esempio n. 4
0
		static void Main (string[] args)
		{
			try {
				Team team = new Team (12);
				TeamLeader teamLeader = new TeamLeader ("Паша");
				House house = new House ();

				for (int i = 0; i < team.Length; ++i) {
					Log.WriteLog (new Message (team [i].Work (house), team [i].ToString ()));
					Log.WriteLog (new Message (teamLeader.Work (house), teamLeader.ToString ()));
				}
				Console.WriteLine (teamLeader.Work (house));
			} catch (Exception ex) {
				Log.WriteLog (new Message (ex.Message));
			}
		}
Esempio n. 5
0
        public override string Work(House house)
        {//make report
            StringBuilder str=new StringBuilder();
            if (house.basement.IsBuilding) str = str.Append("Построен фундамент\n");
            for (int i = 0; i < house.walls.Length; ++i)
            {
                if (house.walls[i].IsBuilding) str = str.Append("Построена " + i + " стена\n");
            }
            for (int i = 0; i < house.windows.Length; ++i)
            {
                if (house.windows[i].IsBuilding) str.Append("Построено " + i + " окно\n");

            }
            if (house.door.IsBuilding) str.Append("Построена дверь\n");
            if (house.roof.IsBuilding) str.Append("Построена крыша\n");

            if (str.Length!=0) return str.ToString();
            else return "Ничего не сделано";
        }
Esempio n. 6
0
 public virtual string Work(House house)
 {//build home
     if (!house.basement.IsBuilding)
     {
         house.basement.IsBuilding = true;
         return String.Format("Рабочий {0} построил фундамент\n", this.name);
     }
     for (int i = 0; i < house.walls.Length; ++i)
     {
         if (!house.walls[i].IsBuilding)
         {
             house.walls[i].IsBuilding = true;
             return String.Format("Рабочий {0} построил {1} стену\n", this.name, i);
         }
     }
     for (int i = 0; i < house.windows.Length; ++i)
     {
         if (!house.windows[i].IsBuilding)
         {
             house.windows[i].IsBuilding = true;
             return String.Format("Рабочий {0} построил {1} окно\n", this.name, i);
         }
     }
     if (!house.door.IsBuilding)
     {
         house.door.IsBuilding = true;
         return String.Format("Рабочий {0} построил дверь\n", this.name);
     }
     if (!house.roof.IsBuilding)
     {
         house.roof.IsBuilding = true;
         return String.Format("Рабочий {0} построил крышу\n", this.name);
     }
     return String.Format("Рабочий бездельничает\n");
 }