Esempio n. 1
0
        // Randomly generates customer questions about cats
        public int CatQuestions(Cat animalName)
        {
            Cat animal = animalName;

            int rndnumber = AnimalRescueWorker.RandChoice(1, 6);

            if (rndnumber == 1)
            {
                Console.WriteLine(">>> Tell me about " + animalName.Name + ".");
                return(1);
            }
            else if (rndnumber == 2)
            {
                Console.WriteLine(">>> Can you tell me more about the " + animal.Breed + " breed?");
                return(2);
            }
            else if (rndnumber == 3)
            {
                Console.WriteLine(">>> How old did you say " + animal.Name + " is again?");
                return(3);
            }
            else if (rndnumber == 4)
            {
                Console.WriteLine(">>> What is the adoption fee for " + animal.Name + "?");
                return(4);
            }
            else
            {
                Console.WriteLine(">>> How many animals do you have here?");
                return(5);
            }
        }
Esempio n. 2
0
        // Randomly chooses an animal category
        public int Statement()
        {
            int rndnumber = AnimalRescueWorker.RandChoice(1, 3);

            if (rndnumber == 1)
            {
                Console.WriteLine(">>> Hi, I want to see available dogs.");
                return(1);
            }
            else
            {
                Console.WriteLine(">>> Hi, I want to see available cats.");
                return(2);
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("-----The Animal Rescue Program-----\n");

            // Creates an employee and customer
            Console.WriteLine("-Building employee, Marshall, and customer, Kayla-");
            AnimalRescueWorker   Marshall = new AnimalRescueWorker("Marshall");
            AnimalRescueCustomer Kayla    = new AnimalRescueCustomer("Kayla");

            // Creating available dogs
            Console.WriteLine("-Building 5 dogs and 5 cats-");
            GermanShephard Lika = new GermanShephard("Lika", 5.1, 'F', "Light Brown", "German Shephard",
                                                     72, 190.00, "I am pretty active so I will need plenty of exercise and mental stimulation.", "Yes", "No");

            LabradorRetriever Sapphire = new LabradorRetriever("Sapphire", 9.1, 'F', "Black", "Labrador Retriever",
                                                               55, 150.00, "I am a pretty easy going dog and am treat motivated.", "Yes", "Yes");

            LabradorRetriever Finn = new LabradorRetriever("Finn", 6, 'M', "Chocolate Brown", "Labrador Retriver",
                                                           136, 115.00, "I will be a breeze to train and am excited to learn more tricks!", "Yes", "Yes");

            MixedBreed Hank = new MixedBreed("Hank", 2.11, 'M', "White and Brown", "Mixed Breed",
                                             44, 125.00, "I ADORE plushy toys and will entertain myself with them for hours.", "No", "No");

            MixedBreed Sunny = new MixedBreed("Sunny", 0.11, 'M', "White", "Mixed Breed", 50, 195.00,
                                              "I would love an active family that has the time to exercise me and knows the joys of dog training!", "Older Children okay", "No");

            // Creating available cats
            DomesticShorthair Daisy = new DomesticShorthair("Daisy", 6.2, 'F', "Black", "Domestic Shorthair", 6, 50.00,
                                                            "I'm pretty fearless when it comes to living outdoors.", "Yes", "Yes");

            DomesticShorthair Dom = new DomesticShorthair("Dom", 9, 'M', "Black", "Domestic Shorthair", 8, 25.00,
                                                          "I'm still unpacking, so I haven't had a chance to sit down for my blog interview yet.", "Yes", "Yes");

            DomesticShorthair Bathilda = new DomesticShorthair("Bathilda", 12.7, 'F', "Black", "Domestic Shorthair", 8, 25.00,
                                                               "I have some things to overcome and work on but my foster mom says my potty skills are on point!", "Yes", "Yes");

            Siamese Benedict = new Siamese("Benedict", 1.7, 'M', "White", "Siamese", 8, 50.00, "I love playtime and batting around the jingly ball toys," +
                                           "\nrunning after the fabric mice, and playing with my brother, Benedict.", "Yes", "Yes");

            Siamese Tony = new Siamese("Tony", 1.7, 'M', "White", "Siamese", 8, 50.00, "My brother and I don't have to be adopted together but it sure would be great " +
                                       "\nto have a companion to play with while you're at school, work, or running errands." +
                                       "\nAnd if that happens to be with my brother, that would be terrific.", "Yes", "Yes");

            Console.WriteLine("-Putting dogs and cats into lists-");
            // Putting all dogs into a list
            List <string> AdoptableDogs = new List <string>
            {
                "Lika",
                "Sapphire",
                "Finn",
                "Hank",
                "Sunny"
            };

            // Putting all cats into a list
            List <string> AdoptableCats = new List <string>
            {
                "Daisy",
                "Dom",
                "Bathilda",
                "Benedict",
                "Tony"
            };

            int animalsAvailable = Animal.getNumOfAnimals();

            /* Will loop through program until 5 animals are adopted
             * Demonstrates randomization of program and various options */
            while (animalsAvailable > 5)
            {
                // Employee greets the customer and customer chooses to view dogs or cats
                Console.WriteLine("-Beginning interactions between employee, customer, and animals-\n");
                Marshall.Greeting();

                int customerInterest = Kayla.Statement();
                Console.WriteLine("");

                // Display available dogs or cats according to customer interest
                if (customerInterest == 1)
                {
                    foreach (string i in AdoptableDogs)
                    {
                        Console.WriteLine(i);
                    }
                }
                else
                {
                    foreach (string i in AdoptableCats)
                    {
                        Console.WriteLine(i);
                    }
                }

                Console.WriteLine("");

                // Placeholders until customer chooses specific dog or cat
                Dog  dogChoice            = Lika;
                Cat  catChoice            = Bathilda;
                bool foundAdoptableAnimal = false;

                // Get random numbers
                int numDog = AnimalRescueWorker.RandChoice(1, 6);
                int numCat = AnimalRescueWorker.RandChoice(1, 6);

                // Customer decides which animal they want within chosen category
                if (customerInterest == 1)
                {
                    while (foundAdoptableAnimal == false)
                    {
                        if (numDog == 1)
                        {
                            if (Lika.Adopted == false)
                            {
                                Console.WriteLine("Lika is available for adoption.\n");
                                dogChoice            = Lika;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Lika was recently adopted. Choose another dog.\n");
                                numDog++;
                            }
                        }
                        else if (numDog == 2)
                        {
                            if (Sapphire.Adopted == false)
                            {
                                Console.WriteLine("Sapphire is available for adoption.\n");
                                dogChoice            = Sapphire;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Sapphire was recently adopted. Choose another dog.\n");
                                numDog++;
                            }
                        }
                        else if (numDog == 3)
                        {
                            if (Finn.Adopted == false)
                            {
                                Console.WriteLine("Finn is available for adoption.\n");
                                dogChoice            = Finn;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Finn was recently adopted. Choose another dog.\n");
                                numDog++;
                            }
                        }
                        else if (numDog == 4)
                        {
                            if (Hank.Adopted == false)
                            {
                                Console.WriteLine("Hank is available for adoption.\n");
                                dogChoice            = Hank;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Hank was recently adopted. Choose another dog.\n");
                                numDog++;
                            }
                        }
                        else
                        {
                            if (Sunny.Adopted == false)
                            {
                                Console.WriteLine("Sunny is available for adoption.\n");
                                dogChoice            = Sunny;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Sunny was recently adopted. Choose another dog.\n");
                                numDog = 1;
                            }
                        }
                    }
                }
                if (customerInterest == 2)
                {
                    while (foundAdoptableAnimal == false)
                    {
                        if (numCat == 1)
                        {
                            if (Daisy.Adopted == false)
                            {
                                Console.WriteLine("Daisy is available for adoption.\n");
                                catChoice            = Daisy;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Daisy was recently adopted. Choose another dog.\n");
                                numCat++;
                            }
                        }
                        else if (numCat == 2)
                        {
                            if (Dom.Adopted == false)
                            {
                                Console.WriteLine("Dom is available for adoption.\n");
                                foundAdoptableAnimal = true;
                                catChoice            = Dom;
                            }
                            else
                            {
                                Console.WriteLine("Dom was recently adopted. Choose another dog.\n");
                                numCat++;
                            }
                        }
                        else if (numCat == 3)
                        {
                            if (Bathilda.Adopted == false)
                            {
                                Console.WriteLine("Bathilda is available for adoption.\n");
                                catChoice            = Bathilda;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Bathilda was recently adopted. Choose another dog.\n");
                                numCat++;
                            }
                        }

                        else if (numCat == 4)
                        {
                            if (Benedict.Adopted == false)
                            {
                                Console.WriteLine("Benedict is available for adoption.\n");
                                catChoice            = Benedict;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Benedict was recently adopted. Choose another dog.\n");
                                numCat++;
                            }
                        }
                        else
                        {
                            if (Tony.Adopted == false)
                            {
                                Console.WriteLine("Tony is available for adoption.\n");
                                catChoice            = Tony;
                                foundAdoptableAnimal = true;
                            }
                            else
                            {
                                Console.WriteLine("Tony was recently adopted. Choose another dog.\n");
                                numCat = 1;
                            }
                        }
                    }
                }

                int customerQuestion;

                // Customer asks a question about their animal of choice
                if (customerInterest == 1)
                {
                    customerQuestion = Kayla.DogQuestions(dogChoice);
                }
                else
                {
                    customerQuestion = Kayla.CatQuestions(catChoice);
                }


                // Answers the customer's question
                if (customerInterest == 1)
                {
                    switch (customerQuestion)
                    {
                    case 1:
                        dogChoice.getDescription();
                        break;

                    case 2:
                        if (dogChoice.Breed == "German Shephard")
                        {
                            GermanShephard.GermanShephardFacts();
                        }
                        else if (dogChoice.Breed == "Labrador Retriever")
                        {
                            LabradorRetriever.LabradorRetrieverFacts();
                        }
                        else
                        {
                            MixedBreed.MixedBreedFacts();
                        }
                        break;

                    case 3:
                        Console.WriteLine(dogChoice.Age);
                        break;

                    case 4:
                        Console.WriteLine(dogChoice.AdoptionFee.ToString("C", CultureInfo.CurrentCulture));
                        break;

                    case 5:
                        Console.WriteLine(Animal.getNumOfAnimals());
                        break;
                    }
                }
                else
                {
                    switch (customerQuestion)
                    {
                    case 1:
                        catChoice.getDescription();
                        break;

                    case 2:
                        if (catChoice.Breed == "Domestic Shorthair")
                        {
                            DomesticShorthair.DomesticShorthairFacts();
                        }
                        else
                        {
                            Siamese.SiameseFacts();
                        }
                        break;

                    case 3:
                        Console.WriteLine(catChoice.Age);
                        break;

                    case 4:
                        Console.WriteLine(catChoice.AdoptionFee.ToString("C", CultureInfo.CurrentCulture));
                        break;

                    case 5:
                        Console.WriteLine(Animal.getNumOfAnimals());
                        break;
                    }
                }

                Console.WriteLine("");

                /* Employee asks if customer is ready to adopt an animal
                 * Customer either says no and leaves or yes and finishes the adoption process */
                Marshall.Question();

                int customerDecision = AnimalRescueWorker.RandChoice(1, 3);

                if (customerDecision == 1)
                {
                    Console.WriteLine(">>> No thanks, I've changed my mind.");
                    Marshall.DisappointedGoodbye();
                }
                else
                {
                    Console.WriteLine(">>> Yes!");
                    Console.WriteLine("");


                    // Customer will interact with animal until the happiness level is satisfactory
                    Random rnd       = new Random();
                    int    rndnumber = rnd.Next(1, 6);

                    if (customerInterest == 1)
                    {
                        bool readyToAdopt = dogChoice.Adopt();
                        while (readyToAdopt == false)
                        {
                            rndnumber = rnd.Next(1, 6);
                            if (rndnumber == 1)
                            {
                                dogChoice.GiveTreat();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 2)
                            {
                                dogChoice.Pet();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 3)
                            {
                                dogChoice.Play();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 4)
                            {
                                dogChoice.Snuggle();
                                Console.WriteLine("");
                            }
                            else
                            {
                                dogChoice.Startle();
                                Console.WriteLine("");
                            }
                            readyToAdopt = dogChoice.Adopt();
                        }
                    }
                    else
                    {
                        bool readyToAdopt = catChoice.Adopt();
                        while (readyToAdopt == false)
                        {
                            rndnumber = rnd.Next(1, 6);
                            if (rndnumber == 1)
                            {
                                catChoice.GiveTreat();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 2)
                            {
                                catChoice.Pet();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 3)
                            {
                                catChoice.Play();
                                Console.WriteLine("");
                            }
                            else if (rndnumber == 4)
                            {
                                catChoice.Snuggle();
                                Console.WriteLine("");
                            }
                            else
                            {
                                catChoice.Snuggle();
                                Console.WriteLine("");
                            }
                            readyToAdopt = catChoice.Adopt();
                        }
                    }

                    // Mark animal as adopted
                    if (customerInterest == 1)
                    {
                        dogChoice.Adopted = true;
                    }
                    else
                    {
                        catChoice.Adopted = true;
                    }

                    // Employee says good-bye to the customer and the program ends
                    Console.WriteLine("");
                    Marshall.SuccessfulGoodbye();
                }

                // Get current animal count
                animalsAvailable = Animal.getNumOfAnimals();
            }
            Console.ReadKey();
        }