Exemple #1
0
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animal> animals = new List <Animal>();
            // Define a new List of dogs
            List <Dog> dogs = new List <Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            animals.Add(dog1);
            animals.Add(dog2);

            // Loop through the list and call a method on the objects
            foreach (Dog d in dogs)
            {
                d.SayName();
            }
            Duck duck1 = new Duck(25, "Harry");
            Duck duck2 = new Duck(45, "Henrietta");

            List <Duck> ducks = new List <Duck>();

            animals.Add(duck1);
            animals.Add(duck2);

            foreach (Animal an in animals)
            {
                an.SayName();
            }

            List <Frog> frogs = new List <Frog>();
            Frog        frog1 = new Frog(36, "Troy", true);
            Frog        frog2 = new InheritanceIntro.Frog(48, "Caden", false);

            frogs.Add(frog1);
            frogs.Add(frog2);

            foreach (Frog f in frogs)
            {
                f.SayName();
            }
        }
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animal> animals = new List <Animal>();

            // Define a new List of dogs
            //List<Dog> dogs = new List<Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            animals.Add(dog1);
            animals.Add(dog2);

            // Loop through the list and call a method on the objects
            //foreach (Dog d in dogs)
            //{
            //    d.sayName();
            //}



            //List<Duck> duckList = new List<Duck>();

            Duck duck1 = new Duck(27, "Queen");
            Duck duck2 = new Duck(31, "Harold");

            animals.Add(duck1);
            animals.Add(duck2);

            //foreach (var duck in duckList)
            //{
            //    duck.sayName();
            //}

            foreach (Animal animal in animals)
            {
                animal.sayName();
            }
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();
            Speakers = new ObservableCollection <Ispeaker>();

            // Define some animals
            Frog frog = new Frog(4, "Kermit", false);
            Dog  dog  = new Dog("Muppet", 20, "Rolf");
            Duck duck = new Duck(9, "Donald");

            // Add the animals to the list
            Speakers.Add(frog);
            Speakers.Add(dog);
            Speakers.Add(duck);

            Robot robot = new Robot("Mike", 2555);

            Speakers.Add(robot);

            lvSpeakers.ItemsSource = Speakers;
        }
Exemple #4
0
        public MainWindow()
        {
            InitializeComponent();
            Animals = new ObservableCollection <Animal>();

            Frog frog = new Frog(4, "Kermit", false, 3);
            Dog  dog  = new Dog("Muppet", 20, "Rolf", 50);
            Duck duck = new Duck(9, "Donald", 30);

            Dog  dogC  = new Dog("Muppet", 200, "Clifford", 1000);
            Duck duckD = new Duck(5, "Daffy", 60);
            Frog frogJ = new Frog(3, "Jeremiah", false, 15);

            Animals.Add(frog);
            Animals.Add(dog);
            Animals.Add(duck);
            Animals.Add(dogC);
            Animals.Add(duckD);
            Animals.Add(frogJ);

            lvAnimals.ItemsSource = Animals;
        }
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            // Define a new List of dogs
            List <Dog> dogs = new List <Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            dogs.Add(dog1);
            dogs.Add(dog2);

            // Loop through the list and call a method on the objects
            foreach (Dog d in dogs)
            {
                d.sayName();
            }
            Duck duck = new Duck(102, "Hai");

            duck.sayName();
        }
Exemple #6
0
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            // Define a new List of dogs
            List <Dog> dogs = new List <Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            dogs.Add(dog1);
            dogs.Add(dog2);

            // Loop through the list and call a method on the objects
            foreach (Dog d in dogs)
            {
                d.SayName();
            }
            Duck        duck1 = new Duck(25, "Henry");
            Duck        duck2 = new Duck(45, "DABOII");
            List <Duck> ducks = new List <Duck>();

            ducks.Add(duck1);
            ducks.Add(duck2);
            foreach (Duck duck in ducks)
            {
                duck.SayName();
            }
            Froggo        frog1   = new Froggo(100, "rndjgvlkjv", true);
            Froggo        frogdos = new Froggo(15, "Senor Froggert", false);
            List <Froggo> frogs   = new List <Froggo>();

            foreach (Froggo frog in frogs)
            {
                frog.SayName();
            }
        }
        private void quackButton_Click(object sender, RoutedEventArgs e)
        {
            Duck duck = new Duck(12, "Mistake");

            duck.Quack();
        }
        private void Quack_Button_Click(object sender, RoutedEventArgs e)
        {
            Duck duck = new Duck();

            duck.Quack();
        }
Exemple #9
0
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animal> animals = new List <Animal>();
            // Define a new List of dogs
            //List<Dog> dogs = new List<Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            animals.Add(dog1);
            animals.Add(dog2);

            // Loop through the list and call a method on the objects

            /*
             * foreach (Dog d in dogs)
             * {
             *  d.SayName();
             * }
             */

            Duck duck1 = new Duck(25, "Harry");
            Duck duck2 = new Duck(45, "Henrietta");

            //List<Duck> ducks = new List<Duck>();
            animals.Add(duck1);
            animals.Add(duck2);

            /*
             * foreach (Duck duck in ducks)
             * {
             *  duck.SayName();
             * }
             */

            Frog frog1 = new Frog(25, "Gary", false);
            Frog frog2 = new Frog(45, "Stan", true);

            //List<Frog> frogs = new List<Frog>();
            animals.Add(frog1);
            animals.Add(frog2);

            /*
             * foreach (Frog frog in frogs)
             * {
             *  frog.SayName();
             * }
             */

            //separation
            WarElephant warElephant1 = new WarElephant(65, "Joe", 5);
            WarElephant warElephant2 = new WarElephant(85, "Zach", 10);

            //List<WarElephant> warElephants = new List<WarElephant>();
            animals.Add(warElephant1);
            animals.Add(warElephant2);

            /*
             * foreach (WarElephant warElephant in warElephants)
             * {
             *  warElephant.SayName();
             * }
             */

            foreach (Animal animal in animals)
            {
                animal.SayName();
            }
        }
        private void VC_Button_Click(object sender, RoutedEventArgs e)
        {
            Duck boy = new Duck(90, "oop");

            boy.VibeCheck();
        }
Exemple #11
0
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animal> animals = new List <Animal>();
            // Define a new List of dogs
            //List<Dog> dogs = new List<Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            // Add the dogs to the list
            animals.Add(dog1);
            animals.Add(dog2);

            // Loop through the list and call a method on the objects
            //foreach (Dog d in animals)
            //{
            //    d.SayName();
            //}

            //List<Duck> ducks = new List<Duck> ();

            Duck duck1 = new Duck(25, "Harry");
            Duck duck2 = new Duck(45, "Henrietta");

            animals.Add(duck1);
            animals.Add(duck2);

            //foreach (Duck d in animals)
            //{
            //    d.SayName();
            //}

            //List<Frog> frogs = new List<Frog>();

            Frog frog1 = new Frog(25, "Croak", true);
            Frog frog2 = new Frog(45, "Pepe", false);

            animals.Add(frog1);
            animals.Add(frog2);

            //foreach (Frog f in animals)
            //{
            //    f.SayName();
            //}


            Cow cow1 = new Cow(25, "Lennard", "brown");
            Cow cow2 = new Cow(45, "Harold", "white");

            animals.Add(cow1);
            animals.Add(cow2);

            //foreach (Cow c in cows)
            //{
            //    c.SayName();
            //}
            foreach (Animal a in animals)
            {
                a.SayName();
                MessageBox.Show("The height is " + a.Height);
            }
        }
        private void quackButton_Click(object sender, RoutedEventArgs e)
        {
            Duck duck = new Duck(12, "Admiral Quackbar");

            duck.Quack();
        }
        private void SayName_Button_Click(object sender, RoutedEventArgs e)
        {
            List <Animals> animal = new List <Animals>();
            // Define a new List of dogs
            //List<Dog> dogs = new List<Dog>();

            // Instantiate some dog objects
            Dog dog1 = new Dog("Muppet", 20, "Rolf");
            Dog dog2 = new Dog("Golden Retriever", 30, "Air Bud");

            //// Add the dogs to the list
            //dogs.Add(dog1);
            //dogs.Add(dog2);

            //// Loop through the list and call a method on the objects
            //foreach (Dog d in dogs)
            //{
            //    d.SayName();
            //}

            Duck duck1 = new Duck(25, "Sir Quacks");
            Duck duck2 = new Duck(45, "Quack Sparrow");
            Duck duck3 = new Duck(35, "James Pond");


            //List<Duck> ducks = new List<Duck>();
            animal.Add(duck1);
            animal.Add(duck2);
            animal.Add(duck3);


            foreach (Duck duck in ducks)
            {
                duck.SayName();
            }

            Frog frog1 = new Frog(5, "Kermit");
            Frog frog2 = new Frog(7, "Lollihops");
            Frog frog3 = new Frog(9, "Frogger");

            List <Frog> frogs = new List <Frog>();

            animal.Add(frog1);
            animal.Add(frog2);
            animal.Add(frog3);

            foreach (Frog frog in frogs)
            {
                frog.SayName();
            }

            Snake snake1 = new Snake(1, "Severus Snake");
            Snake snake2 = new Snake(5, "Nope Rope");
            Snake snake3 = new Snake(5, "Nagini");

            List <Snake> snakes = new List <Snake>();

            animal.Add(snake1);
            animal.Add(snake2);
            animal.Add(snake3);

            //foreach (Snake snake in snakes)
            //{
            //    snake.SayName();
            //}
            foreach (Animals animal in animals)
            {
                ;
            }
        }
        private void quackButton_Click(object sender, RoutedEventArgs e)
        {
            Duck duck = new Duck(12, "Duck of the Silver Turoc");

            duck.Quack();
        }