示例#1
0
        static void Main(string[] args)
        {
            Building dvoyka = new Building("Кремлёвская 35", new Tourniquet());
            Student petya = new Student("Петя");
            Card card = new Card(1, petya.Name);

            if (petya.EnterBuilding(dvoyka, card))
            {
                Console.WriteLine("{0} успешно ушёл вошёл в здание по адресу: {1}", petya.Name, dvoyka.Address);
            }
            else
            {
                Console.WriteLine("{0} не смог войти в здание по адресу: {1}", petya.Name, dvoyka.Address);
            }
        }
示例#2
0
 public bool EnterBuilding(Building building, Card card)
 {
     return UseCard(card, building.Tourniquet);
 }
示例#3
0
        static void Main(string[] args)
        {
            Building uv = new Building("Universiade Village", new Tourniquet());
            Student student1 = new Student("Alsy");
            Card card1 = new Card(1, student1.Name);
            Student student2 = new Student("Andrey");
            Card card2 = new Card(2, student2.Name);

            student1.Print(uv, card1);
            student2.Print(uv, card2);

            Console.ReadLine();
        }
示例#4
0
 public void Print(Building building, Card card)
 {
     if (Enter(building, card))
     {
         Console.WriteLine(Name + " yспешно вошёл в здание по адресу: " + building.Address);
     }
     else
     {
         Console.WriteLine(Name + " не смогла войти в здание по адресу: " + building.Address);
     }
 }
示例#5
0
 public void TryEnter(Building  building)
 {
     if (!building.IsContainsStudent(this)) {
         building.Turnstile.VerifyCard(_card);
         if (building.Turnstile.Opened)
             building.Add(this);
     } else {
         Console.WriteLine("Student is already in building");
     }
 }
示例#6
0
        static void Main(string[] args)
        {
            Student student = new Student("Volodya Ulyanov-Lenin");
            Student someMan = new Student("Billy The Kid");
            Building university = new Building();

            student.TryEnter(university);
            someMan.TryEnter(university);

            university.PrintPresented();

            Console.ReadKey();
        }