Ejemplo n.º 1
0
        public void PetShelter_DisplayAllPets()
        {
            //Arrange

            //Act
            myShelter.PrintAllPets();

            //Assert
            //Assert.("", petList);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Shelter petShelter   = new Shelter();
            bool    keepThinking = true;

            while (keepThinking)
            {
                petShelter.PrintAllPets();
                Console.WriteLine("Hi and Welcome to the Perrysburg Pet Shelter!");
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1. I'm Bringing in a New Organic Pet");
                Console.WriteLine("2. I'm Bringing in a New Robot Pet");
                Console.WriteLine("3. Feed all of the Organic Pets");
                Console.WriteLine("4. Play with all of the Pets");
                Console.WriteLine("5. Play with a Single Pet");
                Console.WriteLine("6. Adopt a Pet");
                Console.WriteLine("7. Give Robot Pet Oil");
                Console.WriteLine("8. Give Robot Pet Maintenance");
                Console.WriteLine("9. Leave the Shelter");

                string menuChoice = Console.ReadLine().ToLower();
                switch (menuChoice)
                {
                case "1":
                {
                    Console.WriteLine("What is your organic pet's name?");
                    string name = Console.ReadLine();

                    Console.WriteLine("What species is your organic pet? (Examples: tiger, dog, fish");
                    string     species = Console.ReadLine();
                    OrganicPet newPet  = new OrganicPet(name, species);
                    petShelter.AddPet(newPet);
                    petShelter.PrintAllPets();
                    Console.WriteLine("\n");
                }
                break;

                case "2":
                {
                    Console.WriteLine("What is your robot pet's name?");
                    string name = Console.ReadLine();

                    Console.WriteLine("What type is your robot pet? (Examples: Robot, Cyborg, Transformer");
                    string     type   = Console.ReadLine();
                    RoboticPet newPet = new RoboticPet(name, type);
                    petShelter.AddPet(newPet);
                    petShelter.PrintAllPets();
                    Console.WriteLine("\n");
                }
                break;

                case "3":
                {
                    petShelter.PrintAllPets();
                    petShelter.FeedAll();
                    Console.WriteLine("You fed the pets!");
                    Console.WriteLine("\n");
                }
                break;

                case "4":
                {
                    petShelter.PrintAllPets();
                    petShelter.PlayAll();
                    Console.WriteLine("You played with the pets!");
                    Console.WriteLine("\n");
                }
                break;

                case "5":
                {
                    petShelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to play with?");
                    string petToPlay = Console.ReadLine();
                    Pet    myPet     = petShelter.PetSelect(petToPlay);
                    myPet.Play();
                    Console.WriteLine($"You played with {myPet.GetName()}!");
                    Console.WriteLine("\n");
                }
                break;

                case "6":
                {
                    petShelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to adopt?");
                    string petToAdopt = Console.ReadLine();
                    Pet    pet        = petShelter.PetSelect(petToAdopt);
                    petShelter.RemovePet(pet);
                    Console.WriteLine($"You gave {pet.GetName()} a good home!");
                    Console.WriteLine("\n");
                }
                break;

                case "7":
                {
                    petShelter.PrintAllPets();
                    petShelter.GiveOil();
                    Console.WriteLine("You gave them oil!");
                    Console.WriteLine("\n");
                }
                break;

                case "8":
                {
                    petShelter.PrintAllPets();
                    petShelter.GiveMaintenance();
                    Console.WriteLine("You gave them maintenance!");
                    Console.WriteLine("\n");
                }
                break;

                case "9":
                {
                    keepThinking = false;
                    Console.WriteLine("Good Bye! Thanks for Visiting!");
                }
                break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Shelter shelter    = new Shelter();
            Pet     roboticPet = new RoboticPet();
            Pet     organicPet = new OrganicPet();

            Console.WriteLine("Hello! Welcome to Virtual Pets, let's create an organic pet to start");
            Console.WriteLine("What is your pet's name?");
            organicPet.SetName(Console.ReadLine());
            Console.WriteLine("What is your pet's species?");
            organicPet.SetSpecies(Console.ReadLine());
            Console.WriteLine($"{organicPet.GetName()} The {organicPet.GetSpecies()} exists!");
            shelter.AddOrganicPet(organicPet);
            Console.WriteLine("Press Enter to start playing");
            Console.ReadLine();

            bool whilePlaying = true;

            do
            {
                shelter.TickAllPets();
                Console.WriteLine("What do you want to do with your pet?");
                Console.WriteLine("1. Feed a pet");
                Console.WriteLine("2. Play with a pet");
                Console.WriteLine("3. Take a pet to the vet");
                Console.WriteLine("4. Check pet status");
                Console.WriteLine("5. Adopt pet");
                Console.WriteLine("6. Add robotic pet");
                Console.WriteLine("7. Add organic pet");
                Console.WriteLine("8. Review Shelter list");
                Console.WriteLine("9. Feed all pets");
                Console.WriteLine("10. Play with all pets");
                Console.WriteLine("11. Take all pets to the vet");
                Console.WriteLine("12. Quit");
                string menuChoice = Console.ReadLine();
                Console.Clear();
                switch (menuChoice)
                {
                case "1":
                {
                    shelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to feed?");
                    int petNumber   = Convert.ToInt32(Console.ReadLine());
                    Pet petToChoose = shelter.FindPetByIndex(petNumber - 1);
                    petToChoose.Feed();
                    Console.WriteLine($"You fed {petToChoose.Name}!");
                    petToChoose.CheckPetStatus();
                    break;
                }

                case "2":
                {
                    shelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to play with?");
                    int petNumber   = Convert.ToInt32(Console.ReadLine());
                    Pet petToChoose = shelter.FindPetByIndex(petNumber - 1);
                    petToChoose.Play();
                    Console.WriteLine($"You played with {petToChoose.Name}!");
                    petToChoose.CheckPetStatus();
                    break;
                }

                case "3":
                {
                    shelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to take to the vet?");
                    int petNumber   = Convert.ToInt32(Console.ReadLine());
                    Pet petToChoose = shelter.FindPetByIndex(petNumber - 1);
                    petToChoose.SeeDoctor();
                    Console.WriteLine($"You took {petToChoose.Name} to the vet!");
                    petToChoose.CheckPetStatus();
                    break;
                }

                case "4":
                {
                    shelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to check up on?");
                    int petNumber   = Convert.ToInt32(Console.ReadLine());
                    Pet petToChoose = shelter.FindPetByIndex(petNumber - 1);
                    petToChoose.CheckPetStatus();
                    break;
                }

                case "5":
                {
                    shelter.PrintAllPets();
                    Console.WriteLine("Which pet will be adopted? This pet will be permanently removed from the shelter");
                    int petNumber   = Convert.ToInt32(Console.ReadLine());
                    Pet petToChoose = shelter.FindPetByIndex(petNumber - 1);
                    shelter.RemovePetFromList(petToChoose);
                    Console.WriteLine($"{petToChoose.GetName()} Found a new home :)");
                    break;
                }

                case "6":
                {
                    roboticPet = new RoboticPet();
                    Console.WriteLine("What is your pet's name?");
                    roboticPet.SetName(Console.ReadLine());
                    Console.WriteLine("What is your pet's species?");
                    roboticPet.SetSpecies(Console.ReadLine());
                    shelter.AddRoboticPet(roboticPet);
                    Console.WriteLine($"{roboticPet.GetName()} The Robo-{roboticPet.GetSpecies()} exists!");
                    break;
                }

                case "7":
                {
                    organicPet = new OrganicPet();
                    Console.WriteLine("What is your pet's name?");
                    organicPet.SetName(Console.ReadLine());
                    Console.WriteLine("What is your pet's species?");
                    organicPet.SetSpecies(Console.ReadLine());
                    shelter.AddOrganicPet(organicPet);
                    Console.WriteLine($"{organicPet.GetName()} The {organicPet.GetSpecies()} exists!");
                    break;
                }

                case "8":
                {
                    shelter.PrintAllPetDetails();
                    break;
                }

                case "9":
                {
                    shelter.FeedAllPets();
                    break;
                }

                case "10":
                {
                    shelter.PlayWithAllPets();

                    break;
                }

                case "11":
                {
                    shelter.AllPetsSeeDoctor();
                    break;
                }

                case "12":
                {
                    whilePlaying = false;
                    break;
                }

                default:
                {
                    Console.WriteLine("Please enter a valid number");
                    break;
                }
                }
            } while (whilePlaying);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Pet     newPet     = new Pet();
            Shelter petShelter = new Shelter();

            petShelter.AddPet(newPet);
            bool keepThinking = true;

            while (keepThinking)
            {
                Console.WriteLine("Hi and Welcome to the Perrysburg Pet Shelter!");
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("1. I'm Bringing in a New Organic Pet");
                Console.WriteLine("2. I'm Brining in a New Mechcanical Pet");
                Console.WriteLine("3. Feed all of the Pets");
                Console.WriteLine("4. Play with all of the Pets");
                Console.WriteLine("5. Play with a Single Pet");
                Console.WriteLine("6. Adopt a Pet");
                Console.WriteLine("7. Leave the Shelter");
                //Console.Clear();
                string menuChoice = Console.ReadLine().ToLower();

                switch (menuChoice)
                {
                case "1":
                    newPet = new Pet();
                    Console.WriteLine("What is your organic pet's name?");
                    string name = Console.ReadLine();
                    newPet.SetName(name);

                    Console.WriteLine("What species is your organic pet? (Example: tiger, dog, fish");
                    string species = Console.ReadLine();
                    newPet.SetSpecies(species);
                    petShelter.AddPet(newPet);
                    petShelter.PrintAllPets();
                    Console.WriteLine("\n");
                    break;
                    //case "2":
                    Console.WriteLine("What is your mechcanical pet's name?");
                    string name = Console.ReadLine();
                    newPet.SetName(name);

                    Console.WriteLine("What type is your pet? (Example: Robot or Cyborg");
                    string species = Console.ReadLine();
                    newPet.SetSpecies(species);
                    petShelter.AddPet(newPet);
                    petShelter.PrintAllPets();
                    Console.WriteLine("\n");
                    break;

                case "3":
                    petShelter.PrintAllPets();
                    petShelter.FeedAll();
                    Console.WriteLine("You fed the pets!");
                    Console.WriteLine("\n");
                    break;

                case "4":
                    petShelter.PrintAllPets();
                    petShelter.PlayAll();
                    Console.WriteLine("You played with the pets!");
                    Console.WriteLine("\n");
                    break;

                case "5":
                    petShelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to play with?");
                    string petToPlay = Console.ReadLine();
                    newPet = petShelter.PetSelect(petToPlay);
                    petShelter.Play(newPet);
                    Console.WriteLine($"You played with {newPet.GetName()}!");
                    Console.WriteLine("\n");
                    break;

                case "6":
                    petShelter.PrintAllPets();
                    Console.WriteLine("Which pet would you like to adopt?");
                    string petToAdopt = Console.ReadLine();
                    newPet = petShelter.PetSelect(petToAdopt);
                    petShelter.RemovePet(newPet);
                    Console.WriteLine($"You gave {newPet.GetName()} a good home!");
                    Console.WriteLine("\n");
                    break;

                case "7":
                    keepThinking = false;
                    Console.WriteLine("Good Bye! Thanks for Visiting!");
                    break;

                default:
                    break;
                }
            }
        }