Esempio n. 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);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Mogwai    mogwai1    = new Mogwai("Batch 1", "Paleo", "Gizmo", "Brown and White", 5, 4, 3);
            Mogwai    mogwai2    = new Mogwai("Batch 2", "South Beach", "Stripe", "Mahogany and White", 4, 5, 6);
            Mogwai    mogwai3    = new Mogwai("Batch 2", "Pescatarian", "Mohawk", "Black and White", 7, 2, 5);
            Volunteer volunteer1 = new Volunteer(1234, "Ringo");
            Volunteer volunteer2 = new Volunteer(1235, "George");
            Manager   manager1   = new Manager(1236, "John", 30000.00);


            int userChoice;


            do
            {
                Console.WriteLine("Welcome to the Mr. Wing's Pet Shelter!");
                Console.WriteLine("What employee type are you?");
                Console.WriteLine("Type 1 for Manager.");
                Console.WriteLine("Type 2 for Volunteer.");
                Console.WriteLine("Type 3 to Quit.");

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

                if (userChoice == 1)
                {
                    Console.WriteLine("Welcome, Manager");
                    do
                    {
                        Console.WriteLine("Mogwai: " + mogwai1.Name + " | " + mogwai2.Name + " | " + mogwai3.Name);
                        Console.WriteLine("Hunger (out of 10): " + mogwai1.HungerLevel + " | " + mogwai2.HungerLevel + " | " + mogwai3.HungerLevel);
                        Console.WriteLine("Thirst (out of 10): " + mogwai1.ThirstLevel + " | " + mogwai2.ThirstLevel + " | " + mogwai3.ThirstLevel);
                        Console.WriteLine("Boredom (out of 10): " + mogwai1.BoredomLevel + " | " + mogwai2.BoredomLevel + " | " + mogwai3.BoredomLevel);
                        Console.WriteLine("");
                        Console.WriteLine("What would you like to do for the mogwai?");
                        Console.WriteLine("Adopt mogwai, type 1");
                        Console.WriteLine("Feed mogwai, type 2");
                        Console.WriteLine("Play with the mogwai, type 3");
                        Console.WriteLine("To exit Manager sub-menu, type 4");

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

                        switch (userChoice)
                        {
                        case 1:
                            Console.WriteLine("Which mogwai would you like to adopt: " + mogwai1.Name + " (" + mogwai1.Description + "), " + mogwai2.Name + " (" + mogwai2.Description + "), or " + mogwai3.Name + " (" + mogwai3.Description + ")?");
                            string adoptee = Console.ReadLine();
                            Console.WriteLine(adoptee + " is an excellent choice.");
                            manager1.AdoptMogwai();
                            break;

                        case 2:
                            mogwai1.FedMogwai();
                            mogwai2.FedMogwai();
                            mogwai3.FedMogwai();
                            break;

                        case 3:
                            Console.WriteLine("Which mogwai do you wish to play with?");
                            Console.WriteLine("Type 1 for " + mogwai1.Name + ".");
                            Console.WriteLine("Type 2 for " + mogwai2.Name + ".");
                            Console.WriteLine("Type 3 for " + mogwai3.Name + ".");
                            int playmate = int.Parse(Console.ReadLine());
                            if (playmate == 1)
                            {
                                mogwai1.PlayedWithMogwai();
                                break;
                            }
                            if (playmate == 2)
                            {
                                mogwai2.PlayedWithMogwai();
                                break;
                            }
                            if (playmate == 3)
                            {
                                mogwai3.PlayedWithMogwai();
                                break;
                            }
                            else
                            {
                                break;
                            }

                        case 4:
                            Console.WriteLine("You have exited the Manager sub-menu.");
                            Console.WriteLine("");
                            break;
                        }

                        //tick
                        mogwai1.TickMethod();
                        mogwai2.TickMethod();
                        mogwai3.TickMethod();
                    } while (userChoice != 4);
                }
                if (userChoice == 2)
                {
                    Console.WriteLine("Welcome, Volunteer!");
                    do
                    {
                        Console.WriteLine("Mogwai: " + mogwai1.Name + " | " + mogwai2.Name + " | " + mogwai3.Name);
                        Console.WriteLine("Hunger (out of 10): " + mogwai1.HungerLevel + " | " + mogwai2.HungerLevel + " | " + mogwai3.HungerLevel);
                        Console.WriteLine("Thirst (out of 10): " + mogwai1.ThirstLevel + " | " + mogwai2.ThirstLevel + " | " + mogwai3.ThirstLevel);
                        Console.WriteLine("Boredom (out of 10): " + mogwai1.BoredomLevel + " | " + mogwai2.BoredomLevel + " | " + mogwai3.BoredomLevel);
                        Console.WriteLine("");
                        Console.WriteLine("What would you like to do for the mogwai?");
                        Console.WriteLine("Feed mogwai, type 1");
                        Console.WriteLine("Give the mogwai something to drink, type 2");
                        Console.WriteLine("Play with the mogwai, type 3");
                        Console.WriteLine("To exit Volunteer sub-menu, type 4");

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

                        switch (userChoice)
                        {
                        case 1:
                            volunteer1.FeedPets();
                            mogwai1.FedMogwai();
                            mogwai2.FedMogwai();
                            mogwai3.FedMogwai();
                            break;

                        case 2:
                            volunteer1.WaterPets();
                            mogwai1.WateredMogwai();
                            mogwai2.WateredMogwai();
                            mogwai3.WateredMogwai();
                            break;

                        case 3:
                            Console.WriteLine("Which mogwai do you wish to play with?");
                            Console.WriteLine("Type 1 for " + mogwai1.Name + ".");
                            Console.WriteLine("Type 2 for " + mogwai2.Name + ".");
                            Console.WriteLine("Type 3 for " + mogwai3.Name + ".");
                            int playmate = int.Parse(Console.ReadLine());
                            if (playmate == 1)
                            {
                                mogwai1.PlayedWithMogwai();
                                break;
                            }
                            if (playmate == 2)
                            {
                                mogwai2.PlayedWithMogwai();
                                break;
                            }
                            if (playmate == 3)
                            {
                                mogwai3.PlayedWithMogwai();
                                break;
                            }
                            else
                            {
                                break;
                            }

                        case 4:
                            Console.WriteLine("You have exited the Volunteer sub-menu.");
                            Console.WriteLine("");
                            break;
                        }

                        //tick
                        mogwai1.TickMethod();
                        mogwai2.TickMethod();
                        mogwai3.TickMethod();
                    } while (userChoice != 4);
                }
                else
                {
                    Console.WriteLine("Goodbye.");
                    break;
                }
            } while (userChoice != 3);
        }