예제 #1
0
        static void Main(string[] args)
        {
            Manager   manOne   = new Manager("Bob");
            Volunteer vol      = new Volunteer();
            Volunteer volOne   = new Volunteer(30, "Tim");
            Volunteer volTwo   = new Volunteer(20, "Cody");
            Volunteer volThree = new Volunteer(15, "Bill");

            VirtualPet Cat      = new VirtualPet();
            VirtualPet catOne   = new VirtualPet(2, 30, 30, 30, "Mittens", "Young and Shy");
            VirtualPet catTwo   = new VirtualPet(13, 20, 20, 15, "Furball", "Old and Fat");
            VirtualPet catThree = new VirtualPet(7, 22, 43, 56, "Sir Pur-a-lot", "Mid-Aged and Average");

            manOne.EmployeeID   = 1111;
            volOne.EmployeeID   = 2222;
            volTwo.EmployeeID   = 3333;
            volThree.EmployeeID = 4444;


            //Main Menu

            int userChoice = 0;

            do
            {
                Console.WriteLine("Main Menu");
                Console.WriteLine();
                Console.WriteLine("Employee Type:");
                Console.WriteLine("Managers press 1.");
                Console.WriteLine("Volunteers press 2.");
                Console.WriteLine();
                Console.WriteLine("To exit press 3.");
                userChoice = int.Parse(Console.ReadLine());
                Console.WriteLine();
                if (userChoice == 1)
                {
                    do
                    {
                        Console.WriteLine();
                        Console.WriteLine("Manager menu:");
                        Console.WriteLine("To check Volunteer status press 1.");
                        Console.WriteLine("Clock in press 2.");
                        Console.WriteLine("Status of the pets press 3.");
                        Console.WriteLine("To start the adoption process press 4.");
                        Console.WriteLine("To go back to the main menu press 5.");
                        userChoice = int.Parse(Console.ReadLine());
                        switch (userChoice)
                        {
                        case 1:
                            Console.WriteLine("Employee information:");
                            Console.WriteLine("Name   ID   Hours");
                            Console.WriteLine("-------------------");
                            Console.WriteLine("{0}  {1}  {2}", volOne.VolunteerName, volOne.EmployeeID, volOne.HoursAvailable);
                            Console.WriteLine("{0}  {1}  {2}", volTwo.VolunteerName, volTwo.EmployeeID, volTwo.HoursAvailable);
                            Console.WriteLine("{0}  {1}  {2}", volThree.VolunteerName, volThree.EmployeeID, volThree.HoursAvailable);
                            Console.WriteLine();
                            Console.WriteLine("Press any key to continue.");
                            Console.ReadKey();
                            break;

                        case 2:
                            Console.WriteLine(manOne.ClockIn());
                            Console.WriteLine("Press any key to continue.");
                            Console.ReadKey();
                            break;

                        case 3:

                            Console.Clear();
                            Console.WriteLine("Name Hunger Thirst Age");
                            Console.WriteLine("-------------------------------");
                            Console.WriteLine("{0} {1} {2} {3}", catOne.Name, catOne.Hunger, catOne.Thirst, catOne.Age);
                            Console.WriteLine();
                            Console.WriteLine("{0} {1} {2} {3}", catTwo.Name, catTwo.Hunger, catTwo.Thirst, catTwo.Hunger, catTwo.Age);
                            Console.WriteLine();
                            Console.WriteLine("{0} {1} {2} {3}", catThree.Name, catThree.Hunger, catThree.Thirst, catThree.Hunger, catThree.Age);
                            Console.WriteLine();
                            Console.WriteLine("Press any key to continue.");
                            Console.ReadKey();
                            break;

                        case 4:
                            Console.Clear();
                            Console.WriteLine("Type the name of the pet which is getting adopted.");
                            Console.WriteLine();
                            Console.WriteLine("Available pets:");
                            Console.WriteLine("-------------------------------");
                            Console.WriteLine("{0}" + " is " + "{1}", catOne.Name, catOne.Description);
                            Console.WriteLine();
                            Console.WriteLine("{0}" + " is " + "{1}", catTwo.Name, catTwo.Description);
                            Console.WriteLine();
                            Console.WriteLine("{0}" + " is " + "{1}", catThree.Name, catThree.Description);
                            string adopterPet = Console.ReadLine().ToLower();
                            if (adopterPet == "mittens")
                            {
                                Console.WriteLine("Mittens has been adopted.");
                            }
                            else if (adopterPet == "furball")
                            {
                                Console.WriteLine("Furball has been adopted.");
                            }
                            else if (adopterPet == "sir Pur-a-lot")
                            {
                                Console.WriteLine("Sir Pur-a-lot has been adopted.");
                            }
                            Console.WriteLine("Press any key to continue.");
                            Console.ReadKey();
                            break;
                        }
                    } while (userChoice != 5);
                }
                else if (userChoice == 2)
                {
                    do
                    {
                        Console.Clear();

                        Console.WriteLine("Volunteer menu:");
                        Console.WriteLine("To clock in press 1.");
                        Console.WriteLine("To feed the pets press 2.");
                        Console.WriteLine("To give the pets water press 3.");
                        Console.WriteLine("To play with a pet press 4.");
                        Console.WriteLine("To exit and return to the main menu press 5.");
                        userChoice = int.Parse(Console.ReadLine());
                        switch (userChoice)
                        {
                        case 1:
                            Console.WriteLine(vol.ClockIn());
                            Console.WriteLine("Press a key to continue.");
                            Console.ReadKey();
                            break;

                        case 2:
                            catOne.Feed();
                            catTwo.Feed();
                            catThree.Feed();
                            Console.WriteLine(vol.FeedPets());
                            Console.WriteLine("Press a key to continue.");
                            Console.ReadKey();
                            break;

                        case 3:
                            catOne.GiveWater();
                            catTwo.GiveWater();
                            catThree.GiveWater();
                            Console.WriteLine(vol.WaterPets());
                            Console.WriteLine("Press a key to continue.");
                            Console.ReadKey();
                            break;

                        case 4:
                            Console.WriteLine("Type the name of the pet you want to play with.");
                            Console.WriteLine(catOne.Name);
                            Console.WriteLine(catTwo.Name);
                            Console.WriteLine(catThree.Name);
                            string playPet = Console.ReadLine().ToLower();
                            if (playPet == "mittens")
                            {
                                Console.WriteLine("You played with Mittens");
                            }
                            else if (playPet == "furball")
                            {
                                Console.WriteLine("You played with Furball");
                            }
                            else if (playPet == "Sir Pur-a-lot")
                            {
                                Console.WriteLine("You played with Sir Pur-a-lot");
                            }
                            Console.WriteLine("Press a key to continue.");
                            Console.ReadKey();
                            break;
                        }
                    } while (userChoice != 5);
                }
                else
                {
                    Console.WriteLine("Goodbye!");
                }
            } while (userChoice != 3);
        }
예제 #2
0
        static void Main(string[] args)
        {
            int    userChoice;
            string userInput;

            Volunteer  newVolunteer = new Volunteer();
            Manager    newManager   = new Manager();
            VirtualPet newDog       = new VirtualPet("Sirius", "Black dog who has human like intelligence.", 25, 22, 20);
            VirtualPet newCat       = new VirtualPet("Crookshanks", "Orange Cat who hates rats.", 50, 40, 92);
            VirtualPet newToad      = new VirtualPet("Trevor", "Green toad who often gets lost.", 20, 46, 76);
            VirtualPet newOwl       = new VirtualPet("Hedwig", "White owl who really likes mail.", 55, 83, 67);

            // fixed
            //newCat.Name = "Crookshanks ";
            //newDog.Name = "Sirius ";
            //newOwl.Name = "Hedwig ";
            //newToad.Name = "Trevor ";
            //newCat.Description = " Orange cat who hates rats.";
            //newDog.Description = " Black dog with human like intelligence.";
            //newToad.Description = " Green toad who gets lost easily.";
            //newOwl.Description = " White owl who really like mail.";


            Console.WriteLine("Welcome to the virtual pet shelter!");
            Console.WriteLine();


            // main menu

            Console.WriteLine("Please select an option from the following:");
            Console.WriteLine("Press 1 to clock in as volunteer.");
            Console.WriteLine("Press 2 to clock in as manager. ");
            Console.WriteLine("Press 0 to clock out");


            do
            {
                userChoice = int.Parse(Console.ReadLine());

                switch (userChoice)
                {
                case 1:
                {
                    Console.Clear();
                    newVolunteer.ClockIn();
                    Console.WriteLine("Thank you for volunteering!");
                    do
                    {
                        //volunteer menu
                        Console.WriteLine("Current pet values");
                        Console.WriteLine("| Name        | Hunger | Thirst   | Boredom |");
                        Console.WriteLine("| Sirius      | " + newDog.IsHungry + "     | " + newDog.IsThirsty + "       | " + newDog.IsBored + "      | ");
                        Console.WriteLine("| CrookShanks | " + newCat.IsHungry + "     | " + newCat.IsThirsty + "       | " + newCat.IsBored + "      | ");
                        Console.WriteLine("| Trevor      | " + newToad.IsHungry + "     | " + newToad.IsThirsty + "       | " + newToad.IsBored + "      | ");
                        Console.WriteLine("| Hedwig      | " + newOwl.IsHungry + "     | " + newOwl.IsThirsty + "       | " + newOwl.IsBored + "      | ");
                        Console.WriteLine();
                        Console.WriteLine("What volunteer task would you like to complete?");
                        Console.WriteLine("Enter 'play' to play with the pets.");
                        Console.WriteLine("Enter 'feed' to give the pets food.");
                        Console.WriteLine("Enter 'water' to give the pets water.");
                        Console.WriteLine("Enter 'leave' to clock out.");
                        Console.WriteLine();


                        userInput = Console.ReadLine().ToLower();

                        if (userInput == "play")
                        {
                            newVolunteer.Play();
                        }
                        if (userInput == "feed")
                        {
                            newCat.IsHungry--;
                            newDog.IsHungry--;
                            newOwl.IsHungry--;
                            newToad.IsHungry--;
                            newVolunteer.FeedPet();
                        }
                        if (userInput == "water")
                        {
                            newCat.IsThirsty--;
                            newDog.IsThirsty--;
                            newOwl.IsThirsty--;
                            newToad.IsThirsty--;
                            newVolunteer.WaterPet();
                        }
                    } while (userInput != "leave");
                    newVolunteer.ClockOut();
                } return;

                case 2:
                {
                    Console.Clear();
                    newManager.ClockIn();
                    Console.WriteLine();

                    do
                    {           //manager menu
                        Console.WriteLine("What manager task would you like to complete?");
                        Console.WriteLine("Enter 'adopt' to set up and adoption.");
                        Console.WriteLine("Enter 'play' to play with the pets.");
                        Console.WriteLine("Enter 'leave' to clock out.");
                        Console.WriteLine();

                        userInput = Console.ReadLine().ToLower();

                        // pet name and descriptions
                        if (userInput == "adopt")
                        {
                            Console.WriteLine();
                            Console.WriteLine("Here are the pets available for adoption.");
                            Console.WriteLine(newDog.Name + " is a " + newDog.Description);
                            Console.WriteLine(newCat.Name + " is an " + newCat.Description);
                            Console.WriteLine(newOwl.Name + " is a " + newOwl.Description);
                            Console.WriteLine(newToad.Name + " is a " + newToad.Description);
                            Console.WriteLine();
                            newManager.Adopt();
                        }
                        if (userInput == "play")
                        {
                            newManager.Play();
                        }
                    } while (userInput != "leave");
                    newManager.ClockOut();
                } return;
                }
            } while (userChoice != 0);
            newManager.ClockOut();
        }
예제 #3
0
        static void Main(string[] args)
        {
            VirtualPet Shoober = new VirtualPet("Shoober", "Chunky", 5, 5, 5);
            VirtualPet Nibbles = new VirtualPet("Nibbles", "Hyper", 5, 5, 5);
            VirtualPet Hubert  = new VirtualPet("Hubert", "Skinny", 5, 5, 5);


            Manager   Bob   = new Manager();
            Volunteer Becky = new Volunteer();

            Console.WriteLine("Welcome to Krang's Cavern! What employee type are you?");
            Console.WriteLine("1. Manager.");
            Console.WriteLine("2. Volunteer.");

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

            if (input == 1)
            {
                Console.WriteLine("Thanks for working for Krang's Cavern! What would you like to do?");
                Console.WriteLine("1. Scan ID.");
                Console.WriteLine("2. Clock in.");
                Console.WriteLine("3. Adopt out a pet.");
                Console.WriteLine("4. Inspire the volunteers.");
                int.Parse(Console.ReadLine());
                if (input == 1)
                {
                    Bob.ShowID();
                }
                else if (input == 2)
                {
                    Bob.ClockIn();
                }
                else if (input == 3)
                {
                    Bob.Adopt();
                }
                else if (input == 4)
                {
                    Bob.Inspire();
                }
                else
                {
                    return;
                }
            }
            else if (input == 2)
            {
                Console.WriteLine("Thanks for vulonteering at Krang's Cavern! What would you like to do?");
                Console.WriteLine(" ");
                Console.WriteLine("This is the status of your pets.");
                Console.WriteLine("Name |Description |Hunger |Thirst |Boredom");
                Console.WriteLine("-----|------------|-------|-------|-------");
                Console.WriteLine(" ");
                Console.WriteLine(" ");
                Console.WriteLine(" ");
                Console.WriteLine("1. Show ID.");
                Console.WriteLine("2. Clock in.");
                Console.WriteLine("3. Feed pets.");
                int.Parse(Console.ReadLine());
                if (input == 1)
                {
                    Becky.ShowID();
                }
                else if (input == 2)
                {
                    Becky.ClockIn();
                }
                else if (input == 3)
                {
                    Becky.Feed();
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }