コード例 #1
0
        static void Main(string[] args)
        {
            Pet pet1 = new Pet("dog", "Shadow", "Jose", 42.6);

            Console.WriteLine("Name: " + pet1.name);
            Console.WriteLine("Weight: " + pet1.weight);
            Console.WriteLine(pet1.getTag());

            Console.WriteLine("");

            Dog dog1 = new Dog("Daisy", "Kent", 23.4);

            Console.WriteLine("Name: " + dog1.name);
            Console.WriteLine("Weight: " + dog1.weight);
            Console.WriteLine(dog1.getTag());
            Console.WriteLine(dog1.bark(4));

            Console.WriteLine("");

            Cat cat1 = new Cat("Simba", "Maria", 5.2);

            Console.WriteLine("Name: " + cat1.name);
            Console.WriteLine("Weight: " + cat1.weight);
            Console.WriteLine(cat1.getTag());
            Console.WriteLine(cat1.meow(3));

            Console.ReadKey();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ChrisPuricelli/Pets
        static void Main(string[] args)
        {
            Pet newPet = new Pet("Dog", "Test pet", "George", 41.4);

            Console.WriteLine("Name: " + newPet.name);
            Console.WriteLine("Weight: " + newPet.weight + " lbs");
            Console.WriteLine(newPet.getTag());

            Dog newDog = new Dog("Pupper", "Jimmy", 21.2);

            Console.WriteLine("\nName: " + newDog.name);
            Console.WriteLine("Weight: " + newDog.weight + " lbs");
            Console.WriteLine(newDog.getTag());
            Console.WriteLine(newDog.bark(4));

            Cat newCat = new Cat("Kitty", "John", 10.8);

            Console.WriteLine("\nName: " + newCat.name);
            Console.WriteLine("Weight: " + newCat.weight + " lbs");
            Console.WriteLine(newCat.getTag());
            Console.WriteLine(newCat.meow(2));

            Console.WriteLine("\nPress any key to continue...");
            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Dog fido = new Dog();

            fido.setValues("Fido", 3, "Brown");
            string tagF = String.Format("{0} is a {1} year old {2} dog",
                                        fido.getName(),
                                        fido.getAge(),
                                        fido.getColor()
                                        );


            Console.WriteLine(tagF + fido.bark());

            Dog lucy = new Dog();

            lucy.setValues("Lucy", 2, "Gray");
            string tagL = String.Format("{0} is a {1} year old {2} dog",
                                        lucy.getName(),
                                        lucy.getAge(),
                                        lucy.getColor()

                                        );


            Console.WriteLine(tagL + lucy.bark());


            Console.ReadKey();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: omardballin/Pet
        static void Main(string[] args)
        {
            // For the Pet class
            Pet pet1 = new Pet("dog", "Shadow", "Jose", 42.6);

            Console.WriteLine("Name: " + pet1.name);
            Console.WriteLine("Weight: " + pet1.weight);
            Console.WriteLine(pet1.getTag());

            Console.WriteLine("");

            //For the Dog class
            Dog dog1 = new Dog("Daisy", "Kent", 23.4);

            Console.WriteLine("Name: " + dog1.name);
            Console.WriteLine("Weight: " + dog1.weight);
            Console.WriteLine(dog1.getTag());
            Console.WriteLine(dog1.bark(4));

            Console.WriteLine("");

            //For the Cat class
            Cat cat1 = new Cat("Simba", "Maria", 5.2);

            Console.WriteLine("Name: " + cat1.name);
            Console.WriteLine("Weight: " + cat1.weight);
            Console.WriteLine(cat1.getTag());
            Console.WriteLine(cat1.meow(3));

            Console.WriteLine("");

            Console.Write("Press any key to continue...");

            Console.ReadLine();
        }