示例#1
0
        public void ExecuteMenuChoice(string menuChoice)
        {
            switch (menuChoice)
            {
            case "1":
                myPet.AddPetToShelter();
                myPet.SetPetName();
                myPet.SetPetSpecies();
                break;

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

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

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

            case "5":
                myPet.TakePetToDoctor();
                break;

            default:
                break;
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            VirtualPet pet = new VirtualPet();

            while (1 == 1)
            {
                Console.WriteLine("Your Pet Name");
                Console.WriteLine("Hunger: " + pet.Hunger);
                Console.WriteLine("Playfulness: " + pet.Playfulness);
                Console.WriteLine("Energy: " + pet.Energy);
                Console.WriteLine("");

                Console.WriteLine("What do you want to do?");
                Console.WriteLine("1. Feed the pet");
                Console.WriteLine("2. Walk the pet");
                Console.WriteLine("3. Play with the pet");
                Console.WriteLine("4. Exit");
                Console.WriteLine("");

                string input = Console.ReadLine();

                string result = "";

                if (input == "1")
                {
                    result = pet.FeedPet();
                }
                else if (input == "2")
                {
                    result = pet.TakeForWalk();
                }
                else if (input == "3")
                {
                    result = pet.Play();
                }
                else if (input == "4")
                {
                    Console.WriteLine("Goodbye");
                    System.Threading.Thread.Sleep(300);
                    break;
                }
                else
                {
                    Console.WriteLine("Invalid entry");
                }
                if (!string.IsNullOrEmpty(result))
                {
                    Console.WriteLine("");
                    Console.WriteLine(result);
                }
                Console.WriteLine("");
                pet.Tick();
            }
        }
        public void InteractWith1Pet()
        {
            Console.WriteLine("\nPlease select a pet from the above list.");

            // list of all pets here with its corresponding index
            ShowPetInfoWithID();

            //user chooses pet(also contains the conversion syntax)
            int userChoice = Convert.ToInt32(Console.ReadLine());

            //look up users petchoice in list
            //set new pet to pet choice within our list

            VirtualPet myPet = myPetList[userChoice - 1];


            string menuChoice    = "";
            bool   userIsPlaying = true;

            //while loop starts here
            while (userIsPlaying)
            {
                Console.WriteLine("\nWhat Would You Like To Do With Your Pet?");
                Console.WriteLine("1. Feed Pet");
                Console.WriteLine("2. Play With Pet");
                Console.WriteLine("3. Take Pet To The Doctor");
                Console.WriteLine("4. Exit");
                menuChoice = Console.ReadLine();

                switch (menuChoice)
                {
                case "1":
                    myPet.FeedPet();
                    break;

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

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

                case "4":
                    userIsPlaying = false;
                    break;

                default:
                    break;
                }
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            //Instantiate the pet
            VirtualPet pet1 = new VirtualPet("Hairy", true, true, false, false, 0);

            //Instantiate variable for user choice.
            int userPick;

            //Print menu of user options.
            do
            {
                Console.WriteLine("\nWhat would you like to do? Enter the number of the menu item, and then click \"Enter\".");

                List <string> userMenu = new List <string> {
                    "1. Show me my pet's info.", "2. Feed pet.", "3. Water pet.", "4. Care for sick pet.", "5. Play with pet.", "6. Take pet outside.", "7. Exit."
                };

                foreach (string menuItem in userMenu)
                {
                    Console.WriteLine(menuItem);
                }

                //User input
                userPick = int.Parse(Console.ReadLine());

                //Conditionals, based on user choice.
                switch (userPick)
                {
                case 1:
                    Console.WriteLine("Here is information about your virtual pet:");
                    pet1.PetStats();
                    break;

                case 2:
                    Console.WriteLine("You are feeding your pet.");
                    pet1.FeedPet();
                    break;

                case 3:
                    Console.WriteLine("You are watering your pet.");
                    pet1.WaterPet();
                    break;

                case 4:
                    Console.WriteLine("You are caring for your sick pet.");
                    pet1.CareForPet();
                    break;

                case 5:
                    Console.WriteLine("You are playing with your pet.");
                    pet1.PlayWithPet();
                    break;

                case 6:
                    Console.WriteLine("You are taking your pet outside to go potty.");
                    pet1.TakePetOutside();
                    break;

                case 7:
                    Console.WriteLine("Have a good day!");
                    break;

                default:
                    Console.WriteLine("Please enter a valid option.");
                    break;
                }
            }while (userPick != 7);
        }
示例#5
0
        static void Main(string[] args)
        {
            //This part allows the user to assignin random numbers to fields.
            Random random = new Random();
            int    Hunger = random.Next(90, 100);
            int    Thirst = random.Next(50, 70);


            //PROPERTIES
            VirtualPet userPet = new VirtualPet();

            userPet.Hunger = Hunger;
            userPet.Thirst = Thirst;


            //UI
            Console.WriteLine("Welcome to the Virtual Pet Shelter!\n Please enter your employee type \n 1- for Manager \n 2- for Volunteer.");
            Console.WriteLine(" Great! - Press any key to view pets status and choose further action...");
            Console.ReadLine();
            Console.Clear();

            do
            {
                userPet.GetStatus();
                //if (userImput ==1)
                //USER MENU 1 (Manager Menu)
                Console.WriteLine("What would you like to do?");
                Console.WriteLine("\tPress 1 to feed {0}.", userPet.PetsName);
                Console.WriteLine("\tPress 2 to give {0} water.", userPet.PetsName);
                Console.WriteLine("\tPress 3 to play with {0}.", userPet.PetsName);
                Console.WriteLine("\tPress 4 to adopt {0}.", userPet.PetsName);
                Console.WriteLine("\tPress 5 to quit the game.");
                int userChoice = int.Parse(Console.ReadLine());

                while (userChoice < 1 || userChoice > 5)
                {
                    Console.WriteLine("You must choose 1 - 4 from the menu!\nWhat do you want to do for your pets?");
                    userChoice = int.Parse(Console.ReadLine());
                }

                switch (userChoice)
                {
                case 1:
                {
                    userPet.FeedPet();
                }
                break;

                case 2:
                {
                    userPet.WaterPet();
                }
                break;

                case 3:
                {
                    userPet.PlayWithPet();
                    break;
                }

                case 4:
                {
                    Console.WriteLine("{0} says, \"Has been adopted!\"", userPet.PetsName);
                    Console.WriteLine("the pets are very happy");
                    Environment.Exit(0);
                }
                break;

                case 5:
                {
                    Console.WriteLine("{0} says, \"What a great worker!\"", userPet.PetsName);
                    Console.WriteLine("the pets are very happy");
                    Environment.Exit(0);
                }
                break;
                    // else (userImput == 2)
                    // USER MENU 2 - Volunteer Menu goes here with additional switch case dialogue
                }
                Console.WriteLine("Press any key to continue");
                Console.ReadLine();
            } while (userPet.PetHappiness <= 75);

            //this section is what prints to the console when the virtual puppy's satisfaction is greater than  or equal to 75).

            //Console.WriteLine("\nCongratulations {0}!\nYou have made {1} very happy today!\nThanks for playing Virtual Pet Shelter!", userPet.PetsName);
        } //MAIN
示例#6
0
        static void Main(string[] args)


        {
            VirtualPet virtualPet = new VirtualPet();
            Shelter    shelter    = new Shelter();



            Console.WriteLine("Welcome to Virtual Pets Place!");

            bool inMenu = true;

            do
            {
                Console.WriteLine("\nEnter Number of Menu Option");
                Console.WriteLine("\n1. Add Pet");
                Console.WriteLine("2. Feed Pet");
                Console.WriteLine("3. Play with Pet");
                Console.WriteLine("4. Take Pet to Doctor");
                Console.WriteLine("5. View Info of All Shelter Pets");
                Console.WriteLine("6. View Status of All Shelter Pets");
                Console.WriteLine("7. Feed All Pets");
                Console.WriteLine("8. Play with All Pets");
                Console.WriteLine("9. Maintain All Pets");
                Console.WriteLine("10. Adopt a Pet");
                Console.WriteLine("11. Exit Game");

                Console.WriteLine(); // <---This is here to add some space between the menu and the user's input

                string petMenuChoice = Console.ReadLine();


                switch (petMenuChoice)
                {
                case "1":
                    Console.WriteLine("\nType your pet's name  below:");
                    string name = Console.ReadLine();


                    Console.WriteLine("\nType your pet's species below:");
                    string species = Console.ReadLine();


                    Console.WriteLine("\nEnter A for an organic pet or B for a robotic pet");
                    string petType = Console.ReadLine().ToLower();

                    if (petType == "a")
                    {
                        VirtualPet organicPet = new OrganicPets();
                        organicPet.AddPet(name, species);
                        shelter.AddPetToShelter(organicPet);
                    }
                    else
                    {
                        VirtualPet roboticPet = new RoboticPets();
                        roboticPet.AddPet(name, species);
                        shelter.AddPetToShelter(roboticPet);
                    }
                    Console.WriteLine("\nYou've added a pet to the Shelter!");
                    break;



                case "2":

                    virtualPet = SelectPetMenu(shelter);
                    Console.WriteLine("\nYou've fed your pet!");
                    virtualPet.FeedPet();
                    break;

                case "3":

                    virtualPet = SelectPetMenu(shelter);
                    Console.WriteLine("\nThanks for playing with me!");
                    virtualPet.PlayPet();
                    break;

                case "4":

                    virtualPet = SelectPetMenu(shelter);
                    Console.WriteLine("\nYour pet's maintenance is A-Okay!");
                    virtualPet.MaintainPet();
                    break;

                case "5":
                    Console.WriteLine("\nChecking all pets info...");

                    //VirtualPet petChoiceInfo = SelectPetMenu(shelter);
                    shelter.DisplayInfoList();
                    break;

                case "6":
                    Console.WriteLine("\nChecking all pets status...");
                    shelter.DisplayStatusList();
                    break;

                case "7":
                    Console.WriteLine("\nYou've fed all your pets!");
                    shelter.FeedAllPets();
                    break;

                case "8":
                    Console.WriteLine("\nThanks for playing with all your pets!");
                    shelter.PlayAllPets();
                    break;

                case "9":
                    Console.WriteLine("\n The doctor says all your pets are A-Okay!");
                    shelter.DoctorAllPets();
                    break;

                case "10":
                    VirtualPet petChoice = SelectPetMenu(shelter);
                    shelter.RemovePet(petChoice);
                    break;


                case "11":
                    inMenu = false;
                    Console.WriteLine("\nSee yah!");
                    break;
                }
            }while (inMenu);
        }