示例#1
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;
                }
            }
        }
        static void Main(string[] args)
        {
            Pet Pet = new Pet();

            Console.WriteLine("Hello! Welcome to Virtual Pets.\n");

            Console.WriteLine("What's the name of your new pet?");
            Pet.SetName(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine("What's the species of your new pet?");
            Pet.SetSpecies(Console.ReadLine());
            Console.WriteLine();

            Console.WriteLine($"\n{Pet.GetName()} the {Pet.GetSpecies()} is here!");

            bool gamePlay = true;

            do
            {
                ;
                Console.WriteLine($"Hunger is {Pet.GetHunger()}.");
                Console.WriteLine($"Boredom is {Pet.GetBoredom()}.");
                Console.WriteLine($"Health is {Pet.GetHealth()}.");
                Pet.Tick();
                Console.WriteLine("\nWhat would you like to do with your pet?\n");

                Console.WriteLine("Play with my pet - press 1");
                Console.WriteLine("\nFeed my pet - press 2");
                Console.WriteLine("\nTake my pet to the doctor - press 3");
                Console.WriteLine("\nQuit - press 4");

                string inPlay = Console.ReadLine();
                Console.Clear();

                switch (inPlay)

                {
                case "1":
                    Pet.Play();
                    break;

                case "2":
                    Pet.Feed();
                    break;

                case "3":
                    Pet.SeeDoctor();
                    break;

                case "4":
                    Console.WriteLine("Thanks for playing!");
                    gamePlay = false;
                    break;

                default:
                    Console.WriteLine("Enter a number.");
                    break;
                }
            } while (gamePlay);
        }
示例#3
0
        static void Main(string[] args)
        {
            Pet        newPet     = new Pet();
            PetShelter petShelter = new PetShelter();
            RoboticPet roboticPet = new RoboticPet();
            List <Pet> listOfPets = petShelter.GetPetList();

            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine("Hello! Welcome to Virtual Pets");
            Console.ResetColor();
            newPet.CreatePet();

            petShelter.AddPetToShelter(newPet);


            bool continuePlayingWithPet = true;

            do
            {
                petShelter.AllPetsTick();
                petShelter.ShowAllPetStatus();

                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("\nWhat would you like to do?");
                Console.ResetColor();
                Console.WriteLine($"1. Feed {newPet.GetName()}");
                Console.WriteLine($"2. Play with {newPet.GetName()}");
                Console.WriteLine($"3. Take {newPet.GetName()} to doctor or for maintenance");
                Console.WriteLine("4. Add pet");
                Console.WriteLine("5. Add RoboPet");
                Console.WriteLine("6. Feed all pets");
                Console.WriteLine("7. Take all pets to doctor or for maintenance");
                Console.WriteLine("8. Play with all pets");
                Console.WriteLine("9. Select specific pet");
                Console.WriteLine("10. Adopt pet");
                Console.WriteLine("11. Exit virtual pet");

                string userInput = Console.ReadLine();
                Console.Clear();
                switch (userInput)
                {
                case "1":
                {
                    newPet.Feed();
                    break;
                }

                case "2":
                {
                    newPet.Play();
                    Console.WriteLine("You've played with your Pet");
                    break;
                }

                case "3":
                {
                    newPet.CareForPet();
                    break;
                }

                case "4":
                {
                    newPet = new Pet();
                    newPet.CreatePet();

                    petShelter.AddPetToShelter(newPet);
                    break;
                }

                case "5":
                {
                    roboticPet = new RoboticPet();
                    roboticPet.CreatePet();

                    petShelter.AddPetToShelter(roboticPet);
                    break;
                }

                case "6":
                {
                    petShelter.FeedAllPets();
                    break;
                }

                case "7":
                {
                    petShelter.AllPetsSeeDoctor();
                    break;
                }

                case "8":
                {
                    petShelter.AllPetsPlay();
                    break;
                }

                case "9":
                {
                    petShelter.ShowPetNames();
                    Console.WriteLine("What pet do you want to select?");
                    int selectNewPet = Convert.ToInt32(Console.ReadLine());
                    newPet = petShelter.SelectPetFromShelter(selectNewPet - 1);
                    break;
                }

                case "10":
                {
                    petShelter.ShowPetNames();
                    Console.WriteLine("What pet do you want to adopt?");
                    int selectNewPet = Convert.ToInt32(Console.ReadLine());
                    newPet = petShelter.SelectPetFromShelter(selectNewPet - 1);
                    petShelter.AdoptPetFromShelter(newPet);
                    break;
                }

                case "11":
                {
                    Console.WriteLine("Thanks for playing Virtual Pet");
                    continuePlayingWithPet = false;
                    break;
                }
                }
            } while (continuePlayingWithPet);
        }
示例#4
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);
        }
示例#5
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;
                }
            }
        }
        static void Main(string[] args)
        {
            Pet myPet = new Pet();

            Console.WriteLine("Hello! Welcome to Virtual Pets\n");

            Console.WriteLine("You have a new Virtual Pet.  What kind of pet is it?");
            myPet.SetSpecies(Console.ReadLine());

            Console.WriteLine("What is your pet's name?");
            myPet.SetName(Console.ReadLine());

            Console.WriteLine($"{myPet.GetName()} the {myPet.GetSpecies()} is ready to play with you!\n\n");
            Console.WriteLine("Press any key to start playing...");
            Console.ReadKey();
            Console.Clear();

            bool playGame = true;

            do
            {
                myPet.Tick();

                Console.WriteLine("\nWhat would you like to do?");
                Console.WriteLine("1. See my pet's status");
                Console.WriteLine("2. Play with my pet.");
                Console.WriteLine("3. Feed my pet.");
                Console.WriteLine("4. Take my pet to the doctor.");
                Console.WriteLine("5. Quit");

                string gameAction = Console.ReadLine();
                Console.Clear();

                switch (gameAction)
                {
                case "1":
                    myPet.ShowStatus();
                    break;

                case "2":
                    myPet.Play();
                    break;

                case "3":
                    myPet.Feed();
                    break;

                case "4":
                    myPet.SeeDoctor();
                    break;

                case "5":
                    Console.WriteLine("Your pet will miss you!  Good-bye.");
                    playGame = false;
                    break;

                default:
                    Console.WriteLine("Please enter a valid number.");
                    break;
                }
            } while (playGame);
        }