Ejemplo n.º 1
0
        static void Main()
        {
            Tomcat george    = new Tomcat("Pesho", 14);
            Tomcat tosho     = new Tomcat("Tosho", 2);
            Tomcat sasho     = new Tomcat("Sasho", 5);
            Kitten elisabeth = new Kitten("Elisabeth", 1);
            Kitten sara      = new Kitten("Sarah", 3);
            Kitten ivi       = new Kitten("Ivvie", 1);
            Dog    sharo     = new Dog("Sharovar", 8, Gender.Male);
            Dog    svetlin   = new Dog("Svetlin", 3, Gender.Male);
            Dog    mincho    = new Dog("Mincho", 11, Gender.Male);
            Frog   frogcho   = new Frog("Froggy", 1, Gender.Female);

            Tomcat[] tomcats = { george, tosho, sasho };
            Kitten[] kittens = { elisabeth, sara, ivi };
            Dog[]    dogs    = { sharo, svetlin, mincho };

            george.ProduceSound();
            elisabeth.ProduceSound();
            sharo.ProduceSound();
            frogcho.ProduceSound();
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Cat cat = new Cat(2, "Kitty", Cat.Sex.female);
            cat.Sound();

            Kitten kitty = new Kitten(1, "Zori");
            kitty.Sound();

            Tomcat tc = new Tomcat(4, "Tom");
            tc.Sound();

            Frog[] frogs = new Frog[3];
            Frog f1 = new Frog(2, "Froxi", Frog.Sex.female);
            f1.Sound();
            Frog f2 = new Frog(4, "Froxcho", Frog.Sex.male);
            Frog f3 = new Frog(6, "Fifi", Frog.Sex.female);
            frogs[0] = f1;
            frogs[1] = f2;
            frogs[2] = f3;
            //Test AverageAge method
            Console.WriteLine(Animal.AverageAge(frogs));

            Dog[] dogs = new Dog[5];
            Dog d1 = new Dog(12, "Sharo", Animal.Sex.male);
            d1.Sound();
            Dog d2 = new Dog(2, "Rex", Animal.Sex.male);
            Dog d3 = new Dog(10, "Balkan", Animal.Sex.male);
            Dog d4 = new Dog(15, "Lasi", Animal.Sex.female);
            Dog d5 = new Dog(25, "Kari", Animal.Sex.female);
            dogs[0] = d1;
            dogs[1] = d2;
            dogs[2] = d3;
            dogs[3] = d4;
            dogs[4] = d5;

            //Test Average method
            Console.WriteLine(Animal.AverageAge(dogs));
        }