Esempio n. 1
0
        /// <summary>
        /// Creates an instance of the zoo class and configures it as the Como Zoo.
        /// </summary>
        private void CreateComoZoo()
        {
            // Create an instance of the Zoo class.
            this.comoZoo = new Zoo("Como Zoo", 1000, 4, 0.75m, 15.00m, 3640.25m, new Employee("Sam", 42), new Employee("Flora", 98), 3);

            // Add money to the animal snack machine.
            this.comoZoo.AnimalSnackMachine.AddMoney(42.75m);

            // Define an animal variable.
            Animal animal;

            // Create Dolly.
            animal = new Dingo("Dolly", 4, 35.3);

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

            // Add Dolly to the zoo's animal list.
            this.comoZoo.AddAnimal(animal);

            // Create Dixie.
            animal = new Dingo("Dixie", 3, 33.8);

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

            // Add Dixie to the zoo's animal list.
            this.comoZoo.AddAnimal(animal);

            // Create Patty.
            animal = new Platypus("Patty", 2, 15.5);

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

            // Add Patty to the zoo's animal list.
            this.comoZoo.AddAnimal(animal);

            // Create Harold.
            animal = new Hummingbird("Harold", 1, 0.5);

            // Add Harold to the zoo's animal list.
            this.comoZoo.AddAnimal(animal);

            // Create a guest.
            Guest guest = new Guest("Greg", 44, 150.35m, "Brown");

            // Add the guest and sell the ticket to the guest.
            this.comoZoo.AddGuest(guest, this.comoZoo.SellTicket(guest));

            // Create a guest.
            guest = new Guest("Darla", 11, 25.25m, "Salmon");

            // Add the guest and sell the ticket to the guest.
            this.comoZoo.AddGuest(guest, this.comoZoo.SellTicket(guest));
        }
Esempio n. 2
0
        /// <summary>
        /// The button that births an aniaml.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void birthAnimalButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a new bird.
            Animal bird = new Hummingbird("Jeffery", 23, 23, Gender.Male);

            // Make the bird pregnant. Then reprodudce. Lay egg.
            bird.MakePregnant();
            IReproducer baby = bird.Reproduce();

            // Create a new dingo, and make the dingo reproduce.
            Animal      dude    = new Dingo("jim", 32, 23, Gender.Male);
            IReproducer babyTwo = dude.Reproduce();
        }
        /// <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.
            this.comoZoo.AddAnimal(new Dingo(0, "Brutus", 2.25));

            // Create Coco.
            Animal animal = new Dingo(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.
            this.comoZoo.AddAnimal(new Platypus(3, "Paddy", 15.4));

            // Create Bella.
            animal = new Platypus(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"));
        }
Esempio n. 4
0
        /// <summary>
        /// Creates an instance of the zoo class and configures it as the Como Zoo.
        /// </summary>
        private void CreateComoZoo()
        {
            // Create an instance of the Zoo class.
            this.comoZoo = new Zoo("Como Zoo", 1000, 4, 0.75m, 15.00m, 3640.25m, new Employee("Sam", 42), new Employee("Flora", 98), 3);

            // Add money to the animal snack machine.
            this.comoZoo.AnimalSnackMachine.AddMoney(42.75m);

            // Define an animal variable.
            Animal animal;

            // Create a new Dingo and add him to the list of animals.
            animal = new Dingo("Dolly", 4, 35.3);

            animal.MakePregnant();

            this.comoZoo.AddAnimal(animal);

            // Create a new Dingo and add him to the list of animals.
            animal = new Dingo("Dixie", 3, 33.8);

            animal.MakePregnant();

            this.comoZoo.AddAnimal(animal);

            // Create a new platypus and add him to the list of animals.
            animal = new Platypus("Patty", 2, 15.5);

            animal.MakePregnant();

            this.comoZoo.AddAnimal(animal);

            // Create a new Hummingbird and add him to the list of animals.
            animal = new Hummingbird("Harold", 1, 0.5);

            this.comoZoo.AddAnimal(animal);

            // Create a new chimp and add him to the list of animals.
            animal = new Chimpanzee("Noah", 12, 500);

            this.comoZoo.AddAnimal(animal);

            // Create a new eagle and add him to the list of animals.
            animal = new Eagle("Tracy", 300, 10);

            this.comoZoo.AddAnimal(animal);

            // Create a new kangaroo and add him to the list of animals.
            animal = new Kangaroo("Jeff", 25, 30);

            this.comoZoo.AddAnimal(animal);

            // Create a new ostrich and add him to the list of animals.
            animal = new Ostrich("Jake", 40, 200);

            this.comoZoo.AddAnimal(animal);

            // Create a new shark and add him to the list of animals.
            animal = new Shark("Max", 23, 185);

            this.comoZoo.AddAnimal(animal);

            // Create a new squirrel and them to the list.
            animal = new Squirrel("Matt", 21, 200);

            this.comoZoo.AddAnimal(animal);

            // Create a guest.
            Guest guest = new Guest("Greg", 44, 150.35m, "Brown");

            // Add the guest and sell the ticket to the guest.
            this.comoZoo.AddGuest(guest, this.comoZoo.SellTicket(guest));

            // Create a guest.
            guest = new Guest("Darla", 11, 25.25m, "Salmon");

            // Add the guest and sell the ticket to the guest.
            this.comoZoo.AddGuest(guest, this.comoZoo.SellTicket(guest));
        }