示例#1
0
        static void Main(string[] args)
        {
            DogStore.Insert(new Dog()
            {
                Name = "Sparky", Age = 2, Type = "labrador", GoodBoi = true, FavoriteFood = "Chicken"
            });
            DogStore.Insert(new Dog()
            {
                Name = "Sharko", Age = 12, Type = "dzukela", GoodBoi = false, FavoriteFood = "Papuchi"
            });
            DogStore.PrintPets();
            Console.WriteLine("Buying Trpe");
            DogStore.BuyPet("Trpe");
            Console.WriteLine("Buying Sparky");
            DogStore.BuyPet("Sparky");
            DogStore.PrintPets();

            Console.WriteLine("------------------------------");
            CatStore.Insert(new Cat()
            {
                Name = "Mitsi", Age = 2, Type = "domestic", Lazy = true, LivesLeft = 6
            });
            CatStore.Insert(new Cat()
            {
                Name = "Cleo", Age = 12, Type = "dzukela", Lazy = false, LivesLeft = 1
            });
            CatStore.PrintPets();
            Console.WriteLine("Buying aaa");
            CatStore.BuyPet("Aaa");
            Console.WriteLine("Buying Cleo");
            CatStore.BuyPet("Cleo");
            CatStore.PrintPets();

            Console.WriteLine("------------------------------");
            FishStore.Insert(new Fish()
            {
                Name = "Fishy", Age = 2, Type = "clown fish", Color = "Orange", Size = "xs"
            });
            FishStore.Insert(new Fish()
            {
                Name = "Bobby", Age = 12, Type = "shark", Color = "White", Size = "xxl"
            });
            FishStore.PrintPets();
            Console.WriteLine("Buying fishhhh");
            FishStore.BuyPet("Fish");
            Console.WriteLine("Buying Bobby");
            FishStore.BuyPet("Bobby");
            FishStore.PrintPets();

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            #region Data
            Cat            garf     = new Cat("Garfield", 8, 3, true);
            Cat            tom      = new Cat("Tom", 11, 1, false);
            Dog            toby     = new Dog("Toby", 5, true, "PorkRibs");
            Dog            spike    = new Dog("Spike", 11, false, "Flesh");
            Fish           goldie   = new Fish("Goldie", 5, "golden", "XXL");
            Fish           carp     = new Fish("Carp", 3, "black", "Mediym");
            PetStore <Pet> milenici = new PetStore <Pet>();
            milenici.Add(garf); milenici.Add(tom); milenici.Add(toby); milenici.Add(spike); milenici.Add(goldie); milenici.Add(carp);
            PetStore <Fish> fishes = new PetStore <Fish>();
            fishes.Add(goldie); fishes.Add(carp);
            PetStore <Dog> doggies = new PetStore <Dog>();
            doggies.Add(toby); doggies.Add(spike);
            PetStore <Cat> catz = new PetStore <Cat>();
            catz.Add(garf); catz.Add(tom);
            #endregion



            Console.WriteLine(milenici.PrintPets());
            Console.WriteLine("\n \n");
            Console.WriteLine(fishes.PrintPets());
            Console.WriteLine("\n");
            Console.WriteLine(doggies.PrintPets());
            Console.WriteLine("\n");
            Console.WriteLine(catz.PrintPets());
            Console.WriteLine("\n");
            milenici.BuyPet("Carp");
            catz.BuyPet("Tom");

            Console.WriteLine(milenici.PrintPets());
        }
示例#3
0
        static void Main(string[] args)
        {
            PetStore <Dog>  dogsStore = new PetStore <Dog>();
            PetStore <Cat>  catsStore = new PetStore <Cat>();
            PetStore <Fish> fishStore = new PetStore <Fish>();


            dogsStore.Insert(new Dog("Bobs", 3, true, "meat"));
            dogsStore.Insert(new Dog("Jacky", 5, false, "bread"));

            catsStore.Insert(new Cat("Jenny", 2, false, 6));
            catsStore.Insert(new Cat("Jane", 4, true, 3));

            fishStore.Insert(new Fish("Nemo", 1, "blue", 4));
            fishStore.Insert(new Fish("Mui", 2, "green", 7));


            dogsStore.BuyPet("Bobs");
            catsStore.BuyPet("Mia");

            Console.WriteLine("--------------------------------------------");


            Console.WriteLine("These are the available pets in the stores:");
            dogsStore.PrintPets();
            catsStore.PrintPets();
            fishStore.PrintPets();
        }
示例#4
0
        static void Main(string[] args)
        {
            PetStore <Pet> .Pets.Add(new Dog("Stinky", "Bulldog", 3, "Steak"));

            PetStore <Pet> .Pets.Add(new Dog("Rex", "German Shepherd", 5, "Dog meal"));

            PetStore <Pet> .Pets.Add(new Cat("Bella", "Persian Cat", 1, true, 8));

            PetStore <Pet> .Pets.Add(new Cat("Kitty", "Ragdoll", 2, false, 7));

            PetStore <Pet> .Pets.Add(new Fish("Gray Triggerfish", "Goldfish", 1, "gold", 1.5));

            PetStore <Pet> .Pets.Add(new Fish("King Mackerel", "Guppy", 1, "grey", 1.2));

            PetStore <Pet> .PrintsPets();

            Console.WriteLine("============================");

            PetStore <Pet> .BuyPet(PetStore <Pet> .Pets[1]);

            PetStore <Pet> .BuyPet(PetStore <Pet> .Pets[2]);

            PetStore <Pet> .PrintsPets();


            Console.ReadLine();
        }
示例#5
0
        static void Main(string[] args)
        {
            DogStore.Pets.Add(new Dog("Bella", "Dog", 7, "Bacon"));
            DogStore.Pets.Add(new Dog("Charlie", "Dog", 7, "Chicken"));
            DogStore.Pets.Add(new Dog("Luna", "Dog", 7, "Steak"));

            CatStore.Pets.Add(new Cat("Lily", "Cat", 2, 7));
            CatStore.Pets.Add(new Cat("Gracie", "Cat", 7, 10));
            CatStore.Pets.Add(new Cat("Molly", "Cat", 5, 9));

            FishStore.Pets.Add(new Fish("Blue", "Fish", 1, "Blue", "small"));
            FishStore.Pets.Add(new Fish("Moby", "Fish", 2, "Red-White", "medium"));
            FishStore.Pets.Add(new Fish("Nemo", "Fish", 3, "Orange-black", "big"));


            Console.WriteLine("Printing all pets..");

            DogStore.PrintPets(DogStore.Pets);
            CatStore.PrintPets(CatStore.Pets);
            FishStore.PrintPets(FishStore.Pets);

            Console.WriteLine("----------------------------------");

            Console.WriteLine("Type the name of the dog you want to buy");
            Console.WriteLine(DogStore.BuyPet(Console.ReadLine()));
            Console.WriteLine("Type the name of the cat you want to buy");
            Console.WriteLine(CatStore.BuyPet(Console.ReadLine()));
            Console.WriteLine("Type the name of the fish you want to buy");
            Console.WriteLine(FishStore.BuyPet(Console.ReadLine()));


            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            dogStore.Insert(new Dog()
            {
                Name = "Sharko", Age = 8, Type = "Pinch", GoodBoi = false, FavoriteFood = "salad"
            });
            dogStore.Insert(new Dog()
            {
                Name = "Sparky", Age = 2, Type = "Labrador", GoodBoi = true, FavoriteFood = "chicken"
            });

            dogStore.PrintPets();
            Console.WriteLine("Buying shaeko");
            dogStore.BuyPet("Sharko");
            Console.WriteLine("Buying shaeko");
            dogStore.BuyPet("Sparky");
            dogStore.PrintPets();
        }
示例#7
0
        static void Main(string[] args)
        {
            PetStore.InsertPet(new Cat()
            {
                Name = "Cat1", Type = Enum.Type.Cat, Age = 2, Lazy = true, LifesLeft = 9
            });
            PetStore.InsertPet(new Cat()
            {
                Name = "Cat2", Type = Enum.Type.Cat, Age = 4, Lazy = false, LifesLeft = 4
            });

            PetStore.InsertPet(new Dog()
            {
                Name = "Dog1", Type = Enum.Type.Dog, Age = 2, GoodBoi = true, FavoriteFood = "snacks"
            });
            PetStore.InsertPet(new Dog()
            {
                Name = "Dog2", Type = Enum.Type.Dog, Age = 4, GoodBoi = false, FavoriteFood = "Dog's food"
            });

            PetStore.InsertPet(new Fish()
            {
                Name = "Fish1", Type = Enum.Type.Fish, Age = 2, Color = "Gold", Size = "Small"
            });
            PetStore.InsertPet(new Fish()
            {
                Name = "Fish2", Type = Enum.Type.Fish, Age = 4, Color = "Black", Size = "Medium"
            });

            PetStore.BuyPet("Jackie");
            PetStore.BuyPet("Cat2");

            PetStore.BuyPet("Roman");
            PetStore.BuyPet("Dog1");

            PetStore.PrintAll();
            Console.ReadLine();
            Console.WriteLine("Hello World!");
        }
        static void Main(string[] args)
        {
            PetStore <Dog> Dog1 = new PetStore <Dog>();
            PetStore <Dog> Dog2 = new PetStore <Dog>();

            PetStore <Cat> Cat1 = new PetStore <Cat>();
            PetStore <Cat> Cat2 = new PetStore <Cat>();

            PetStore <Fish> Fish1 = new PetStore <Fish>();
            PetStore <Fish> Fish2 = new PetStore <Fish>();

            Dog1.Insert(new Dog()
            {
                Name = "Dog1", Age = 5, FavouriteFood = "bacon", GoodBoi = true, Type = "Beagle"
            });
            Dog2.Insert(new Dog()
            {
                Name = "Dog2", Age = 6, FavouriteFood = "meat", GoodBoi = true, Type = "Labrador"
            });

            Cat1.Insert(new Cat()
            {
                Name = "Cat1", Age = 2, IsLazy = true, Type = "Some cat type", LivesLeft = 9
            });
            Cat2.Insert(new Cat()
            {
                Name = "Cat2", Age = 3, IsLazy = true, Type = "Some cat type3", LivesLeft = 8
            });

            Fish1.Insert(new Fish()
            {
                Name = "Fish1", Age = 1, Type = "Goldfish", Color = "gold", Size = 2
            });
            Fish2.Insert(new Fish()
            {
                Name = "Fish2", Age = 2, Type = "Goldfish2", Color = "gold", Size = 3
            });

            Dog1.PrintPets();
            Dog2.PrintPets();

            Cat1.PrintPets();
            Cat2.PrintPets();

            Fish1.PrintPets();
            Fish2.PrintPets();

            Dog1.BuyPet("Dog3");
            Cat1.BuyPet("Cat1");
        }
示例#9
0
        static void Main(string[] args)
        {
            DogStore.AddPetToTheStore(new Dog()
            {
                Name = "Roki", Age = 1, GoodBoy = true, FavoriteFood = "AllFood", Type = "Yorki"
            });
            DogStore.AddPetToTheStore(new Dog()
            {
                Name = "Lea", Age = 4, GoodBoy = false, FavoriteFood = "Beef", Type = "Retriver"
            });

            CatStore.AddPetToTheStore(new Cat()
            {
                Name = "Garfild", Age = 2, isLazy = true, LifesLeft = 5, Type = "Abyssinian"
            });
            CatStore.AddPetToTheStore(new Cat()
            {
                Name = "Claud", Age = 1, isLazy = false, LifesLeft = 1, Type = "Bengal"
            });

            FishStore.AddPetToTheStore(new Fish()
            {
                Name = "Nemo", Age = 2, Color = "orange", Size = 2, Type = "clownfish"
            });
            FishStore.AddPetToTheStore(new Fish()
            {
                Name = "Dori", Age = 1, Color = "blue", Size = 1, Type = "Paracanthurus hepatus"
            });

            DogStore.BuyPet("Roki");
            CatStore.BuyPet("idi");

            Console.WriteLine("Dog Store:");
            DogStore.PrintAll();

            Console.WriteLine("Cat Store:");
            CatStore.PrintAll();

            Console.WriteLine("Fish Store:");
            FishStore.PrintAll();


            Console.ReadLine();
        }
示例#10
0
        static void Main(string[] args)
        {
            Dog dog1 = new Dog("Sparky", "Shepard", 5, "bone", false);
            Dog dog2 = new Dog("Spic", "Doga", 4, "meat", true);
            Dog dog3 = new Dog("Balto", "Doberman", 2, "pizza", true);

            Cat cat1 = new Cat("Tom", "domestic", 1, 9, true);
            Cat cat2 = new Cat("Smokey", "Siamese", 3, 5, false);
            Cat cat3 = new Cat("Sammy", "Persian", 6, 2, false);

            Fish fish1 = new Fish("Nemo", "Mollies", 1, "Yellow", "medium");
            Fish fish2 = new Fish("Bubbles", "Zebra Danios", 2, "Blue", "small");
            Fish fish3 = new Fish("Captain", "Platies", 2, "Black", "big");

            PetStore <Dog> dogStore = new PetStore <Dog>();

            dogStore.addPets(dog1);
            dogStore.addPets(dog2);
            dogStore.PrintPets();
            dogStore.BuyPet(dog3);
            Console.WriteLine("================================");

            PetStore <Cat> catStore = new PetStore <Cat>();

            catStore.addPets(cat3);
            catStore.addPets(cat1);
            catStore.PrintPets();
            catStore.BuyPet(cat3);
            Console.WriteLine("================================");

            PetStore <Fish> fishStore = new PetStore <Fish>();

            fishStore.addPets(fish2);
            fishStore.addPets(fish3);
            fishStore.PrintPets();
            fishStore.BuyPet(fish3);
            Console.ReadLine();
        }
示例#11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to PetStore!");
            #region AddData
            ListOfDogs.AddPets(new Dog()
            {
                Name = "Spike", Type = "Dog", Age = 2, GoodBoi = true, FavoriteFood = "Spagheti"
            });
            ListOfDogs.AddPets(new Dog()
            {
                Name = "Jacky", Type = "Dog", Age = 4, GoodBoi = false, FavoriteFood = "Bone"
            });

            ListOfCats.AddPets(new Cat()
            {
                Name = "Lucky", Type = "Cat", Age = 3, Lazy = false, LivesLeft = 9
            });
            ListOfCats.AddPets(new Cat()
            {
                Name = "Smok", Type = "Cat", Age = 5, Lazy = true, LivesLeft = 3
            });

            ListOfFishes.AddPets(new Fish()
            {
                Name = "Goldy", Type = "Fish", Age = 3, Color = "Yellow", Size = 5
            });
            ListOfFishes.AddPets(new Fish()
            {
                Name = "Great White", Type = "Fish", Age = 10, Color = "Blue", Size = 20
            });

            Console.WriteLine("Dogs:");
            ListOfDogs.printPets();
            Console.WriteLine("========================");

            Console.WriteLine("Cats:");
            ListOfCats.printPets();
            Console.WriteLine("========================");

            Console.WriteLine("Fishes:");
            ListOfFishes.printPets();
            Console.WriteLine("\n");
            #endregion

            #region BuyPet
            Console.WriteLine("Dogs");
            ListOfDogs.BuyPet("Spike");

            Console.WriteLine("Pets left in the store");
            ListOfDogs.printPets();
            Console.WriteLine("========================");

            Console.WriteLine("Cats");
            ListOfCats.BuyPet("Rade");

            Console.WriteLine("Pets left in the store");
            ListOfCats.printPets();
            Console.WriteLine("========================");
            #endregion

            Console.ReadLine();
        }
示例#12
0
        static void Main(string[] args)
        {
            Dog kuce = new Dog {
                Age = 10, FavoriteFood = "bones", Name = "Labrador", Type = "Labrador"
            };
            Dog kuce1 = new Dog {
                Age = 10, FavoriteFood = "meat", Name = "Malinois", Type = "Malinois"
            };
            Dog kuce2 = new Dog {
                Age = 10, FavoriteFood = "macki", Name = "Beagle", Type = "Beagle"
            };

            Cat mace = new Cat {
                Name = "Persiska", Age = 100, isLazy = true, LivesLeft = 8, Type = "Persiska"
            };
            Cat mace1 = new Cat {
                Name = "Domasnomace", Age = 80, isLazy = false, LivesLeft = 4, Type = "Domasno"
            };
            Cat mace2 = new Cat {
                Name = "UlicnoMace", Age = 10, isLazy = false, LivesLeft = 1, Type = "Ulicno"
            };

            Fish ripce = new Fish {
                Name = "Nemo", Age = 10, Type = "Nemo", Color = "White", Size = 10
            };
            Fish ripce1 = new Fish {
                Name = "Cilchild", Age = 5, Type = "Cichild", Color = "Yellow", Size = 9
            };
            Fish ripce2 = new Fish {
                Name = "Shark", Age = 5, Type = "Shark", Color = "Black", Size = 8
            };



            PetStore <Dog> dogStore = new PetStore <Dog>()
            {
            };
            PetStore <Cat> catStore = new PetStore <Cat>()
            {
            };
            PetStore <Fish> fishStore = new PetStore <Fish>()
            {
            };

            List <Dog> listOfCDOgs = dogStore.ListOfPets = new List <Dog> {
                kuce, kuce1, kuce2
            };
            List <Cat> listOfCats = catStore.ListOfPets = new List <Cat> {
                mace, mace1, mace2
            };


            //dogStore.BuyPet("Labrador");
            //dogStore.BuyPet("Malinois");


            Console.WriteLine("Enter a pet name to buy");
            string input = Console.ReadLine();

            catStore.BuyPet(input);
            Thread.Sleep(1000);

            Console.ForegroundColor = ConsoleColor.Yellow;
            catStore.PrintPets();
        }
示例#13
0
        static void Main(string[] args)
        {
            #region Exercise
            //      Create 4 classes:
            //  Pet( abstract ) with Name, Type, Age and abstract PrintInfo()
            //  Dog(from Pet) with GoodBoi and FavoriteFood
            //  Cat(from Pet) with Lazy and LivesLeft
            //  Fish(from Pet) with color, size

            //      Create a PetStore generic class with :
            //  Generic list of pets - Dogs, Cats or Fish depending on what is passed as T
            //  Generic method printsPets() - Prints Dogs, Cats or Fish depending on what is passed as T
            //  BuyPet() - Method that takes ‘name’ as parameter, find the first pet by that name, removes it from the list and gives a success message.If there is no pet by that name, inform the customer
            //      Create a Dog, Cat and fish store with 2 pets each
            //  Buy a dog and a cat from the Dog and Cat store
            //  Call PrintPets() method on all stores
            #endregion

            PetStore <Dog>  dogStore  = new PetStore <Dog>();
            PetStore <Cat>  catStore  = new PetStore <Cat>();
            PetStore <Fish> fishStore = new PetStore <Fish>();

            dogStore.Insert(new Dog()
            {
                Type = "dog", Name = "Nero", Age = 14, isGood = true, FavouriteFood = "chicken"
            });
            dogStore.Insert(new Dog()
            {
                Type = "dog", Name = "Shegy", Age = 10, isGood = true, FavouriteFood = "beaf meat"
            });
            dogStore.Insert(new Dog()
            {
                Type = "dog", Name = "Puppy", Age = 5, isGood = false, FavouriteFood = "eggs"
            });
            dogStore.Insert(new Dog()
            {
                Type = "dog", Name = "Bully", Age = 7, isGood = true, FavouriteFood = "beaf meat"
            });

            Console.WriteLine("---------All Dogs in Dog Store:---------");
            dogStore.PrintPets();
            dogStore.BuyPet("shegy ");

            catStore.Insert(new Cat()
            {
                Type = "cat", Name = "Mario", isLazy = true, LivesLeft = 10, Age = 2
            });
            catStore.Insert(new Cat()
            {
                Type = "cat", Name = "Luiji", isLazy = false, LivesLeft = 10, Age = 2
            });
            catStore.Insert(new Cat()
            {
                Type = "cat", Name = "Mimi", isLazy = false, LivesLeft = 9, Age = 3
            });


            Console.WriteLine("---------All Cats in Cat Store:---------");
            catStore.PrintPets();
            catStore.BuyPet("Mimi");

            fishStore.Insert(new Fish()
            {
                Type = "fish", Name = "Boo", Color = "Blue", Size = 4.3f, Age = 4
            });
            fishStore.Insert(new Fish()
            {
                Type = "fish", Name = "Loly", Color = "Purple", Size = 3.5f, Age = 3
            });

            Console.WriteLine("---------All Fishes in Fish Store:---------");
            fishStore.PrintPets();
            fishStore.BuyPet("jiM ");
        }