Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //new instance of the pet
            VirtualPet myPet = new VirtualPet();


            //greet the user here
            Console.WriteLine("Hello, thank you for taking care of Ezra!");
            Console.WriteLine();


            int selectedOption;

            do
            {
                //these are the pet interactions
                Console.WriteLine();
                Console.WriteLine("What would you like to do today?");
                Console.WriteLine("1. Feed the pet");                //decreases hunger
                Console.WriteLine("2. Train the pet");               //increases intelligence
                Console.WriteLine("3. Give them water");             //decreases thirst
                Console.WriteLine("4. Play with them");              //decreases boredom
                Console.WriteLine("5. Tell the pet about your day"); //increases social need
                Console.WriteLine("6. Quit");                        //ends the game
                Console.WriteLine();



                selectedOption = int.Parse(Console.ReadLine());

                myPet.MyPetStatus();

                switch (selectedOption)
                {
                //when the user selects options, these switch cases change the stats
                case 1:

                    myPet.HungerDecrease();
                    Console.WriteLine("Thank you for feeding Ezra!");
                    break;

                case 2:

                    myPet.IntelIncrease();
                    Console.WriteLine("Ezra can now do new tricks!");
                    break;

                case 3:

                    myPet.ThirstDecrease();
                    Console.WriteLine("Thank you for keeping Ezra hydrated!");
                    break;

                case 4:

                    myPet.BoredomDecrease();
                    Console.WriteLine("Wow, Ezra sure is having fun!");
                    break;

                case 5:

                    myPet.SocialIncrease();
                    Console.WriteLine("Ezra certainly found your day interesting!");
                    break;

                case 6:

                    Console.WriteLine("Come back any time! (^_^)\"/\"");
                    break;

                default:

                    Console.WriteLine("Yikes! You chose to do nothing with that invalid option...");
                    break;
                }

                myPet.HungerIncrease();
                myPet.SocialDecrease();
                myPet.ThirstIncrease();
                myPet.BoredomIncrease();
            } while (selectedOption != 6);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //this is how we instantiate a new instance of our pet

            //int hunger = 1;
            //int thirst = 2;

            //TODO add a greeting for the user. you can also let the user name the pet if you like

            Console.WriteLine("Hello and welcome to Virtual Petland!");
            Console.WriteLine("What would you like to name your pet kangaroo?");
            string     petName = Console.ReadLine();
            VirtualPet myPet   = new VirtualPet(petName, 1, 2, "pat", "run", "jump");
            int        selectedOption;

            do
            {
                //TODO fill this out with more options to interact with the pet
                Console.WriteLine();
                Console.WriteLine("Please select an option between 1 and 5.  Type 'Q' to Quit ");
                Console.WriteLine("1. Feed " + petName);
                Console.WriteLine("2. Give " + petName + " something to drink");
                Console.WriteLine("3. Take " + petName + " for a run");
                Console.WriteLine("4. Pat " + petName + " on the head");
                Console.WriteLine("5. Tell " + petName + " to do a trick");
                Console.WriteLine("'10'. Quit");
                selectedOption = int.Parse(Console.ReadLine());

                while (selectedOption >= 1 && selectedOption <= 5)
                {
                    ;
                }

                myPet.MyPetStatus();

                switch (selectedOption)
                {
                //when the user selects option one we feed the pet
                //when the user selects option two we give the pet a drink
                //when the user selects option three we pat the pet on the head
                //when the user selects option four we take the pet for a run
                //when the user selects option five we ask the pet to jump through a hoop
                case 1:
                    myPet.HungerDecrease();
                    Console.WriteLine("Thank you for feeding the pet");
                    Console.WriteLine("Bubbles has been fed, and hunger Level has been decreased");
                    break;

                case 2:
                    myPet.ThirstDecrease();
                    Console.WriteLine(petName + " thanks you for the water!");
                    Console.WriteLine("Bubbles has been fed, and hunger Level has been decreased");
                    break;

                case 3:
                    myPet.TouchPet();
                    Console.WriteLine("What a sweet thing to do for " + petName);
                    Console.WriteLine("Bubbles has been fed but may still be a little hungry. Hunger Level has been decreased");
                    break;

                case 4:
                    myPet.ExercisePet();
                    Console.WriteLine("Oh what fun to take " + petName + "for a run!");
                    break;

                case 5:
                    myPet.TricksPet();
                    Console.WriteLine(petName + " likes to jump through hoops. What fun!");
                    break;

                case 6:
                    Console.WriteLine("Pat on the head");
                    break;

                case 7:
                    Console.WriteLine("Ride in " + petName + "'s pouch");
                    break;

                case 8:
                    Console.WriteLine("Give " + petName + "a hug");
                    break;

                case 9:
                    Console.WriteLine(petName + " thanks you for the love!");
                    break;

                case 10:
                    Console.WriteLine(petName + " has enjoyed spending time with you. Good-bye! ");
                    Console.WriteLine("Thank you for playing with" + petName);
                    break;

                default:
                    Console.WriteLine("Pick a valid option");
                    break;

                    //TODO we need to add more cases for the other ways to interact with our pet
                }

                //TODO We can put method calls here so the pet can have some values change automatically
                //Feel free to add, remove, or modify which methods are called here

                myPet.HungerDecrease();

                {
                    Console.WriteLine("Invalid option. Please select a number between 1 and 5, or select '10' to Quit");
                }
                Console.WriteLine("Please select an option to touch " + petName);
                Console.WriteLine("Select 1 to pat " + petName + "on the head");
                Console.WriteLine("Select 2 to ride in " + petName + "'s pouch");
                Console.WriteLine("Select 3 to hug " + petName);
                Console.WriteLine("Select '10' to Quit");
            }while (selectedOption < 5 && selectedOption > 1);
            {
                Console.WriteLine("That was great! Select another option to keep playing!");
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            //this is how we instantiate a new instance of our pet
            VirtualPet myPet = new VirtualPet();


            //TODO add a greeting for the user. you can also let the user name the pet if you like
            Console.WriteLine("Hi, my name is, Glitch. Thank you for being my new friend!");

            int selectedOption; //I understand that this variable was defined for use later

            do                  //A do while loop! It makes so much sense now!
            {
                //TODO fill this out with more options to interact with the pet
                //Note to self MVP- Add more options later. Make it work first!

                Console.WriteLine("\nPlease select an option\n");
                Console.WriteLine("1. Feed me"); //Changed these options to sound like user was actually interacting with pet
                Console.WriteLine("2. Play a game with me");
                Console.WriteLine("3. Take me to the vet");
                Console.WriteLine("4. Give me water");
                Console.WriteLine("5. Take me to the bathroom");
                Console.WriteLine("10. Quit");
                Console.WriteLine("\n");

                selectedOption = int.Parse(Console.ReadLine()); //converts user input into a string to be used for interaction
                Console.WriteLine("\n");

                myPet.MyPetStatus();    //Note to self, Is this calling the class myPet? Figure out why this works...

                switch (selectedOption) //I remember switch case and prefer this option when it is a good fit
                {
                //when the user selects option one we feed the pet
                case 1:

                    myPet.HungerDecrease();
                    Console.WriteLine("Thank you, the food was yummy!\n");
                    break;

                case 2:     //when selected, user plays with the pet

                    myPet.LessBored();
                    Console.WriteLine("Thank you, I had so much fun playing!\n");
                    break;

                case 3:     //when selected, user takes Glitch to the vet

                    myPet.LessSick();
                    Console.WriteLine("Thank you, I feel much better!\n");
                    break;

                case 4:     //when selected, user gives pet water

                    myPet.LessThirsty();
                    Console.WriteLine("Thank you, that water was delicious!\n");
                    break;

                case 5:     //when selected, user takes glitch to the bathroom
                    myPet.GottaGoLater();
                    Console.WriteLine("Thank you for taking me to the bathroom.\n");
                    break;

                //TODO we need to add more cases for the other ways to interact with our pet

                case 10:

                    Console.WriteLine("Thank you for taking such great care of me.");
                    break;

                default:

                    Console.WriteLine("Invalid option selected.");
                    break;
                }

                //TODO We can put method calls here so the pet can have some values change automatically
                //Feel free to add, remove, or modify which methods are called here
                myPet.HungerIncrease();
                myPet.MoreThirsty();
                myPet.GottaGoNow();

                //***Your methods should cause the appropriate fields to update -
                //***for instance, if you have a Feed() method, it might make Hunger go down, but make Thirst go up.
                //Note to self: I understand that these methods are being called and that's why they work
                //figure out why calling the method works vs using an if else statement
                //also figure out if an if else can be used in a loop for more control of what increases and why
                //for example thirst increasing after eating or playing...
            } while (selectedOption != 10); //The switch was inside of a loop allowing the magic to happen.
                                            //it really makes so much sense now!
        }