示例#1
0
        /// <summary>
        /// Makes the animal pregnant.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void makePregnantButton_Click(object sender, RoutedEventArgs e)
        {
            animal.MakePregnant();

            // Changes the label from No, to yes.
            pregnancyStatusLabel.Content = "Yes";
        }
示例#2
0
        /// <summary>
        /// Creates a zoo and related objects.
        /// </summary>
        /// <param name="sender">The object that initiated the event.</param>
        /// <param name="e">The event arguments for the event.</param>
        private void newZooButton_Click(object sender, RoutedEventArgs e)
        {
            // Create Sam.
            Employee employee = new Employee("Sam", 42);

            // Create the Como Zoo.
            this.comoZoo = new Zoo(employee, 1000, "Como Zoo", 4, 15m);

            // Set birthing room temperature.
            this.comoZoo.BirthingRoomTemperature = 77;

            // Add Sam to the Zoo.
            this.comoZoo.AddEmployee(employee);

            // Create Flora
            employee = new Employee("Flora", 98);

            // Add Flora to the Zoo.
            this.comoZoo.AddEmployee(employee);

            // Create Brutus and add him to Como Zoo. (Dingo)
            this.comoZoo.AddAnimal(new Animal(0, "Di", 2.25));

            // Create Coco.
            Animal animal = new Animal(5, "Coco", 25.8);

            // Make Coco pregnant.
            animal.MakePregnant();

            // Add Coco to the Como Zoo.
            this.comoZoo.AddAnimal(animal);

            // Create Paddy and add him to the Como Zoo. (Platypus)
            this.comoZoo.AddAnimal(new Animal(3, "Paddy", 15.4));

            // Create Bella. (Dingo)
            animal = new Animal(6, "Bella", 23.5);

            // Make Bella pregnant.
            animal.MakePregnant();

            // Add Bella to the Como Zoo.
            this.comoZoo.AddAnimal(animal);

            // Create Sally and add her to the Como Zoo.
            this.comoZoo.AddGuest(new Guest(38, 150.35m, "Sally", "Black"));

            // Create Fred and add him to the Como Zoo.
            this.comoZoo.AddGuest(new Guest(11, 15m, "Fred", "Brown"));
        }