public void AddPet(Pet pet)
 {
     allPets.Add(pet);
 }
 public void RemovePet(Pet pet)
 {
     allPets.Remove(pet);
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Pet tyson = new Pet("Tyson", 0, 0, 0, 0);

            Console.WriteLine("Welcome to Virtual Tyson Management Console");
            Console.WriteLine("Please type Yes to manage the dog, {0}", tyson.Name);
            string userResponse = Console.ReadLine().ToLower();

            while (userResponse.Equals("yes"))
            {
                Console.WriteLine("Please select from the following to manage {0}", tyson.Name);

                Console.WriteLine("Select 1 to get the status of {0}", tyson.Name);
                Console.WriteLine("Select 2 to feed {0}", tyson.Name);
                Console.WriteLine("Select 3 to give water to {0}", tyson.Name);
                Console.WriteLine("Select 4 to walk {0}", tyson.Name);
                Console.WriteLine("Select 5 to let {0} sleep", tyson.Name);
                int userChoice = int.Parse(Console.ReadLine());


                switch (userChoice)
                {
                case 1:
                    tyson.GetTick();
                    if (tyson.HungerAlert)
                    {
                        Console.WriteLine("{0} is hungry and needs to be fed.", tyson.Name);
                        Console.WriteLine("Please enter a new food level for {0}", tyson.Name);
                        int newHunger = int.Parse(Console.ReadLine());
                        tyson.SetHunger(newHunger);
                    }

                    if (tyson.ThirstAlert)
                    {
                        Console.WriteLine("{0} is thirsty and needs water.", tyson.Name);
                        Console.WriteLine("Please enter a new water level for {0}", tyson.Name);
                        int newthirstLevel = int.Parse(Console.ReadLine());
                        tyson.SetThirst(newthirstLevel);
                    }

                    if (tyson.BoredomAlert)
                    {
                        Console.WriteLine("{0} is bored and needs to be walked.", tyson.Name);
                        Console.WriteLine("Please enter a new boredom level for {0}.", tyson.Name);
                        int newBoredomLevel = (int.Parse(Console.ReadLine()));
                        tyson.SetBoredom(newBoredomLevel);
                    }

                    if (tyson.TiredAlert)
                    {
                        Console.WriteLine("{0} is tired and needs to sleep.", tyson.Name);
                        Console.WriteLine("Please enter a new tiredness level for {0}.", tyson.Name);
                        int newTirednessLevel = (int.Parse(Console.ReadLine()));
                        tyson.SetTiredness(newTirednessLevel);
                    }


                    Console.WriteLine("{0} has a hunger level of {1}, has a thirst level of {2}, his boredom level is {3}, and his tiredness level is {4}.", tyson.Name, tyson.Hunger, tyson.Thirst, tyson.Boredom, tyson.Tiredness);
                    break;


                case 2:
                    tyson.GetTick();
                    Console.WriteLine("Enter a new hunger level.");
                    int hunger = int.Parse(Console.ReadLine());
                    tyson.SetHunger(hunger);
                    Console.WriteLine("The new hunger level of {0} is {1}", tyson.Name, tyson.Hunger);
                    break;

                case 3:
                    tyson.GetTick();
                    Console.WriteLine("Enter a new thirst level.");
                    int thirst = int.Parse(Console.ReadLine());
                    tyson.SetThirst(thirst);
                    Console.WriteLine("The new thirst level of {0} is {1}", tyson.Name, tyson.Thirst);
                    break;

                case 4:
                    tyson.GetTick();
                    Console.WriteLine("Enter a new boredom level.");
                    int boredom = int.Parse(Console.ReadLine());
                    tyson.SetBoredom(boredom);
                    Console.WriteLine("The new boredom level of {0} is {1}", tyson.Name, tyson.Boredom);
                    break;

                case 5:
                    tyson.GetTick();
                    Console.WriteLine("Enter a new tiredness level.");
                    int tiredness = int.Parse(Console.ReadLine());
                    tyson.SetTiredness(tiredness);
                    Console.WriteLine("The new tiredness level of {0} is {1}", tyson.Name, tyson.Tiredness);

                    break;

                default:
                    break;
                }
                tyson.GetTick();
                Console.WriteLine("Please type Yes to manage {0} ?", tyson.Name);
                userResponse = Console.ReadLine().ToLower();
            } //While end
        }     //Static Void Main End
Ejemplo n.º 4
0
 public void AddPetToShelter(Pet pet)
 {
     listOfPets.Add(pet);
     Console.WriteLine("You admitted a pet into the shelter");
 }
        public Pet FindPetByIndex(int index)
        {
            Pet selectedPet = ShelterList[index];

            return(selectedPet);
        }
Ejemplo n.º 6
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;
                }
            }
        }
 public void AddRoboticPet(Pet pet)
 {
     ShelterList.Add(pet);
 }
 public void AddOrganicPet(Pet pet)
 {
     ShelterList.Add(pet);
 }
 public void RemovePetFromList(Pet pet)
 {
     ShelterList.Remove(pet);
 }
        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);
        }
Ejemplo n.º 11
0
 public void AddPet(Pet pet)
 {
     ListOfPets.Add(pet);
 }