public ShelterTests() { myShelter = new VirtualPet.Shelter(); OrganicPet myPet = new OrganicPet("Steve", "Tiger"); myShelter.AddPet(myPet); }
static void Main(string[] args) { Shelter shelter = new Shelter(); Pet pet = new Pet(); List <Pet> ListOfPets = new List <Pet>(); Console.WriteLine("Hello! Welcome to Virtual Pets\n"); bool petChoice = true; while (petChoice) { Console.WriteLine("What would you like to do?"); Console.WriteLine("NOTE: If you do not have a pet, please create one!"); Console.WriteLine("1. Create a new organic pet"); Console.WriteLine("2. Create a new robotic pet"); Console.WriteLine("3. Display each pet status"); Console.WriteLine("4. Feed your Pet"); Console.WriteLine("5. Play with your Pet"); Console.WriteLine("6. Attend To Pet Health"); Console.WriteLine("7. Quit"); string menuChoice = Console.ReadLine(); switch (menuChoice) { case "1": Console.WriteLine("What is the name for your organic pet?"); string name = Console.ReadLine(); Console.WriteLine("What species is your organic pet?"); string species = Console.ReadLine(); pet = new Organic(name, species); shelter.AddPet(pet); Console.ReadKey(); break; case "2": Console.WriteLine("What is the name of your robotic pet?"); name = Console.ReadLine(); species = "Robot"; pet = new Robotic(name, species); shelter.AddPet(pet); Console.ReadKey(); break; case "3": foreach (Pet selectedPet in shelter.ListOfPets) { selectedPet.DisplayStatus(); } Console.ReadKey(); break; case "4": pet = shelter.SelectPet(); pet.Feed(); Console.WriteLine($"You fed/oiled {pet.GetName()}."); pet.Tick(); break; case "5": pet = shelter.SelectPet(); pet.Play(); Console.WriteLine($"You and {pet.GetName()} played in the meadow together!"); pet.Tick(); break; case "6": pet = shelter.SelectPet(); pet.AttendToPetHealth(); Console.WriteLine($"You took {pet.GetName()} to the vet/mechanic for their health."); pet.Tick(); break; case "7": petChoice = false; break; default: Console.WriteLine("Invalid entry."); break; } Console.WriteLine("Press Enter to continue."); Console.ReadKey(); Console.Clear(); } }
static void Main(string[] args) { Console.WriteLine("Hello! Welcome to Virtual Pets"); Pet pet = new Pet(); OrganicPet organicPet = new OrganicPet(); RoboticPet roboticPet = new RoboticPet(); Shelter shelter = new Shelter(); Console.WriteLine("\nAdmit your first pet into the Shelter"); bool stillThinking = false; while (stillThinking == false) { Console.WriteLine("Would you like to admit an (1)Organic Pet or a (2)Robotic Pet?"); string petType = Console.ReadLine(); if (petType == "1") { pet = new OrganicPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); stillThinking = true; } else if (petType == "2") { pet = new RoboticPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); stillThinking = true; } else { Console.WriteLine("Select (1) or (2)"); } } bool keepThinking = true; while (keepThinking) { Console.WriteLine("1. Feed your pet"); Console.WriteLine("2. Take your pet to the vet"); Console.WriteLine("3. Play with your pet"); Console.WriteLine("4. Admit a New Pet Into Shelter"); Console.WriteLine("5. Show Pet Status"); Console.WriteLine("6. Feed all pets"); Console.WriteLine("7. Take all pets to the vet"); Console.WriteLine("8. Play with all pets"); Console.WriteLine("9. See all pets in shelter"); Console.WriteLine("10. Show status of all pets"); Console.WriteLine("11. Select A Pet"); Console.WriteLine("12. Adopt a Pet from the Shelter"); Console.WriteLine("13. Exit"); string userSelection = Console.ReadLine(); shelter.TickAllPets(); Console.Clear(); switch (userSelection) { case "1": pet.Feed(); break; case "2": pet.SeeVet(); break; case "3": pet.Play(); break; case "4": Console.WriteLine("Would you like to admit an (1)Organic Pet or a (2)Robotic Pet?"); string petType = Console.ReadLine(); if (petType == "1") { pet = new OrganicPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); } else if (petType == "2") { pet = new RoboticPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); } else { Console.WriteLine("Select (1) or (2)"); } break; case "5": pet.ShowPetStatus(); break; case "6": shelter.FeedAllPets(); break; case "7": shelter.SeeVetAllPets(); break; case "8": shelter.PlayAllPets(); break; case "9": shelter.SeeListOfPets(); break; case "10": shelter.SeeStatusOfPets(); break; case "11": shelter.SeeListOfPets(); Console.WriteLine("Select a pet(#)"); int petSelection = Convert.ToInt32(Console.ReadLine()); pet = shelter.SelectPet(petSelection); Console.WriteLine($"You selected {pet.Name} the {pet.Species}"); break; case "12": shelter.SeeListOfPets(); Console.WriteLine("Select a pet(#) to Adopt"); int adoptSelection = Convert.ToInt32(Console.ReadLine()); shelter.DeletePet(adoptSelection); Console.WriteLine($"You adopted {pet.Name} the {pet.Species}"); break; case "13": keepThinking = false; break; } } }
static void Main(string[] args) { Pet myPet = new Pet(); Shelter myShelter = new Shelter(); Organic myOrganic = new Organic(); Robot myRobot = new Robot(); Console.WriteLine("Hello! Welcome to Virtual Pet Shelter"); bool keepPlaying = true; while (keepPlaying) { Console.WriteLine("1. Create Robot Pet"); Console.WriteLine("2. Create Organic Pet"); Console.WriteLine("3. Check On All Pets"); Console.WriteLine("4. Feed or Oil All Pets"); Console.WriteLine("5. Select a Pet to Feed or Oil."); Console.WriteLine("6. Play with All Pets"); Console.WriteLine("7. Select a Pet to Play with."); Console.WriteLine("8. Take All Pets to the Vet or Mechanic"); Console.WriteLine("9. Select a Pet to take to the Vet or Mechanic."); Console.WriteLine("10. Select a Pet to be Adopted from the Shelter."); Console.WriteLine("11. Exit Game"); string menuChoice = Console.ReadLine(); int petBoredom = myPet.GetBoredom(); int petHealth = myPet.GetHealth(); int petHunger = myPet.GetHunger(); int robotPerformance = myRobot.GetPerformance(); int robotOil = myRobot.GetOil(); switch (menuChoice) { case "1": myShelter.AddPet(myRobot); Console.WriteLine("What Species is Your Robot Pet? "); myRobot.SetSpecies(Console.ReadLine()); Console.WriteLine("Please Enter the Name of Your Robot " + myRobot.Species + ": "); myRobot.SetName(Console.ReadLine()); break; case "2": myShelter.AddPet(myOrganic); Console.WriteLine("What Species is Your Organic Pet? "); myOrganic.SetSpecies(Console.ReadLine()); Console.WriteLine("Please Enter the Name of Your Organic " + myOrganic.Species + ": "); myOrganic.SetName(Console.ReadLine()); break; case "3": foreach (Pet pet in myShelter.ListofPets) { Console.WriteLine("The Current Boredom level of " + pet.Name + " is " + petBoredom); if (pet == myOrganic) { Console.WriteLine("The Current Health Level of " + pet.Name + " is " + petHealth); Console.WriteLine("The Current Hunger Level of " + pet.Name + " is " + petHunger); } else if (pet == myRobot) { Console.WriteLine("The Current Oil Level of " + pet.Name + " is " + robotOil); Console.WriteLine("The Current Performance Level of " + pet.Name + " is " + robotPerformance); } } break; case "4": foreach (Pet pet in myShelter.ListofPets) { if (pet == myOrganic) { myPet.Feed(); Console.WriteLine("You Fed " + pet.Name); } else if (pet == myRobot) { myRobot.GetOil(); Console.WriteLine("You gave oil to " + pet.Name); } } break; case "5": myPet = myShelter.SelectPet(); if (myPet == myOrganic) { myPet.Feed(); Console.WriteLine("You Fed " + myPet.Name); } else if (myPet == myRobot) { myRobot.GetOil(); Console.WriteLine("You gave oil to " + myPet.Name); } break; case "6": foreach (Pet pet in myShelter.ListofPets) { pet.Play(); Console.WriteLine("You played with " + pet.Name); } break; case "7": myPet = myShelter.SelectPet(); myPet.Play(); Console.WriteLine("You played with " + myPet.Name); break; case "8": foreach (Pet pet in myShelter.ListofPets) { if (pet == myOrganic) { pet.SeeDoctor(); Console.WriteLine("You took " + pet.Name + " to the vet!"); } else if (pet == myRobot) { myRobot.SeeMechanic(); Console.WriteLine("You took " + pet.Name + " to the mechanic!"); } } break; case "9": myPet = myShelter.SelectPet(); if (myPet == myOrganic) { myPet.SeeDoctor(); Console.WriteLine("You took " + myPet.Name + " to the vet!"); } else if (myPet == myRobot) { myRobot.SeeMechanic(); Console.WriteLine("You took " + myPet.Name + " to the mechanic!"); } break; case "10": myShelter.AdoptPet(); Console.WriteLine("That pet has been adopted!"); break; case "11": Console.WriteLine("Thank's for Playing!"); keepPlaying = false; break; default: Console.WriteLine("Invalid Entry"); break; } myPet.Tick(); Console.WriteLine("Press Any Key to Continue"); Console.ReadKey(); Console.Clear(); } }
static void Main(string[] args) { Shelter petShelter = new Shelter(); bool keepThinking = true; while (keepThinking) { petShelter.PrintAllPets(); 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 Bringing in a New Robot Pet"); Console.WriteLine("3. Feed all of the Organic 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. Give Robot Pet Oil"); Console.WriteLine("8. Give Robot Pet Maintenance"); Console.WriteLine("9. Leave the Shelter"); string menuChoice = Console.ReadLine().ToLower(); switch (menuChoice) { case "1": { Console.WriteLine("What is your organic pet's name?"); string name = Console.ReadLine(); Console.WriteLine("What species is your organic pet? (Examples: tiger, dog, fish"); string species = Console.ReadLine(); OrganicPet newPet = new OrganicPet(name, species); petShelter.AddPet(newPet); petShelter.PrintAllPets(); Console.WriteLine("\n"); } break; case "2": { Console.WriteLine("What is your robot pet's name?"); string name = Console.ReadLine(); Console.WriteLine("What type is your robot pet? (Examples: Robot, Cyborg, Transformer"); string type = Console.ReadLine(); RoboticPet newPet = new RoboticPet(name, type); 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(); Pet myPet = petShelter.PetSelect(petToPlay); myPet.Play(); Console.WriteLine($"You played with {myPet.GetName()}!"); Console.WriteLine("\n"); } break; case "6": { petShelter.PrintAllPets(); Console.WriteLine("Which pet would you like to adopt?"); string petToAdopt = Console.ReadLine(); Pet pet = petShelter.PetSelect(petToAdopt); petShelter.RemovePet(pet); Console.WriteLine($"You gave {pet.GetName()} a good home!"); Console.WriteLine("\n"); } break; case "7": { petShelter.PrintAllPets(); petShelter.GiveOil(); Console.WriteLine("You gave them oil!"); Console.WriteLine("\n"); } break; case "8": { petShelter.PrintAllPets(); petShelter.GiveMaintenance(); Console.WriteLine("You gave them maintenance!"); Console.WriteLine("\n"); } break; case "9": { keepThinking = false; Console.WriteLine("Good Bye! Thanks for Visiting!"); } break; default: break; } } }
public void CreateShelter() { Shelter shelter = new Shelter("Your Shelter"); }
static void Main(string[] args) { Console.WriteLine("Hello! Welcome to Virtual Pets shelter"); Shelter shelter = new Shelter(); Pet pet = new Pet(); Random random = new Random(); bool keepPlaying = true; bool returnToOffice = false; string playerChoice; while (keepPlaying) { Console.WriteLine("Welcome to " + shelter.Name + " Animal Shelter."); Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Name/Re-Name Shelter"); Console.WriteLine("2. Add Organic Pet"); Console.WriteLine("3. Add Robotic Pet"); Console.WriteLine("4. Adopt a Pet"); Console.WriteLine("5. List Pets in Shelter"); Console.WriteLine("6. Enter the Kennel"); Console.WriteLine("7. Quit"); playerChoice = Console.ReadLine(); Console.Clear(); switch (playerChoice) { case "1": Console.WriteLine("What do you want to name your Animal Shelter?"); shelter.Name = Console.ReadLine(); break; case "2": Console.WriteLine("What is the name of your pet?"); string nameOfPet = Console.ReadLine(); Console.WriteLine("What is the species of your pet?"); string speciesOfPet = Console.ReadLine(); Organic organic = new Organic(nameOfPet, speciesOfPet); shelter.AddPet(organic); break; case "3": Console.WriteLine("What is the name of your pet?"); nameOfPet = Console.ReadLine(); Console.WriteLine("What is the species of your pet?"); speciesOfPet = Console.ReadLine(); Robotic robotic = new Robotic(nameOfPet, speciesOfPet); shelter.AddPet(robotic); break; case "4": Console.WriteLine("Which pet would you like to adopt?"); string userPet = Console.ReadLine(); int userPetIndex = shelter.SelectPet(userPet); if (userPetIndex == -1) { Console.WriteLine("That pet isn't listed in our records."); } else { Console.WriteLine(shelter.ListofPets[userPetIndex].Name + " has been adopted."); shelter.RemovePet(userPetIndex); } Console.ReadKey(); break; case "5": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == true) { Console.WriteLine(shelter.ListofPets[i].Name + " the organic " + shelter.ListofPets[i].Species); } else { Console.WriteLine(shelter.ListofPets[i].Name + " the robotic " + shelter.ListofPets[i].Species); } } Console.ReadKey(); break; case "6": returnToOffice = false; while (returnToOffice == false) { Kennel(); } break; case "7": keepPlaying = false; break; default: Console.WriteLine("Please enter a valid number."); break; } Console.Clear(); } void Kennel() { Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Feed all organic pets"); Console.WriteLine("2. Oil all robotic pets"); Console.WriteLine("3. Play with all pets"); Console.WriteLine("4. Take all organic pets to Doctor"); Console.WriteLine("5. Perform maintenence on all Robotic Pets"); Console.WriteLine("6. Interact with a single pet"); Console.WriteLine("7. Check all pet statuses"); Console.WriteLine("8. Return to Office"); playerChoice = Console.ReadLine(); switch (playerChoice) { case "1": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == true) { shelter.ListofPets[i].Feed(); } } Console.WriteLine("You fed the pets!"); break; case "2": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == false) { shelter.ListofPets[i].GiveOil(); } } Console.WriteLine("You oiled the pets!"); break; case "3": for (int i = 0; i < shelter.ListofPets.Count; i++) { shelter.ListofPets[i].Play(); } Console.WriteLine("You played with the pets!"); break; case "4": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == true) { shelter.ListofPets[i].SeeDoctor(); } } Console.WriteLine("You took the pets to the doctor!"); break; case "5": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == false) { shelter.ListofPets[i].PerformMaintenance(); } } Console.WriteLine("You repaired the pets!"); break; case "6": Console.WriteLine("What pet do you want to interact with?"); string userPet = Console.ReadLine(); int userPetIndex = shelter.SelectPet(userPet); SinglePet(userPetIndex); break; case "7": for (int i = 0; i < shelter.ListofPets.Count; i++) { if (shelter.ListofPets[i].IsOrganic == true) { Console.WriteLine($"{shelter.ListofPets[i].Name} the organic {shelter.ListofPets[i].Species}- Hunger: {shelter.ListofPets[i].Hunger} " + $"Health: {shelter.ListofPets[i].Health} Boredom: {shelter.ListofPets[i].Boredom}"); } else if (shelter.ListofPets[i].IsOrganic == false) { Console.WriteLine($"{shelter.ListofPets[i].Name} the robotic {shelter.ListofPets[i].Species}- Oil: {shelter.ListofPets[i].Oil} " + $"Performance: {shelter.ListofPets[i].Performance} Boredom: {shelter.ListofPets[i].Boredom}"); } } break; case "8": Console.WriteLine("Thank you for taking care of the pets."); returnToOffice = true; break; default: Console.WriteLine("Please select a valid option"); break; } shelter.Tick(); Console.ReadKey(); Console.Clear(); } void SinglePet(int index) { bool returnToKennel = false; while (returnToKennel == false) { Console.Clear(); Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Name/Rename " + shelter.ListofPets[index].Name); Console.WriteLine("2. Change Species of " + shelter.ListofPets[index].Name); if (shelter.ListofPets[index].IsOrganic == true) { Console.WriteLine("3. Feed " + shelter.ListofPets[index].Name); Console.WriteLine("4. Play with " + shelter.ListofPets[index].Name); Console.WriteLine("5. Take " + shelter.ListofPets[index].Name + " to Doctor"); } else { Console.WriteLine("3. Oil " + shelter.ListofPets[index].Name); Console.WriteLine("4. Play with " + shelter.ListofPets[index].Name); Console.WriteLine("5. Perform Maintenance on " + shelter.ListofPets[index].Name); } Console.WriteLine("6. Check " + shelter.ListofPets[index].Name + "'s status"); Console.WriteLine("7. Return to Kennel"); playerChoice = Console.ReadLine(); switch (playerChoice) { case "1": Console.WriteLine("What would you like you to rename your pet?"); shelter.ListofPets[index].Name = Console.ReadLine(); Console.WriteLine("You named your pet " + shelter.ListofPets[index].Name); break; case "2": Console.WriteLine("What species do you want " + shelter.ListofPets[index].Name + " to be?"); shelter.ListofPets[index].Species = Console.ReadLine(); Console.WriteLine(shelter.ListofPets[index].Name + " is a " + shelter.ListofPets[index].Species); break; case "3": if (shelter.ListofPets[index].IsOrganic == true) { Console.WriteLine("What would you like to feed " + shelter.ListofPets[index].Name + "?"); string food = Console.ReadLine(); if (random.Next(1, 100) < shelter.ListofPets[index].Boredom) { Console.WriteLine(shelter.ListofPets[index].Name + " doesnt't want your food."); } else { pet.Feed(food.ToLower()); Console.WriteLine("You fed " + shelter.ListofPets[index].Name); Console.WriteLine(shelter.ListofPets[index].Name + "s hunger level is " + shelter.ListofPets[index].Hunger); } } else { Console.WriteLine("You oiled " + shelter.ListofPets[index].Name); shelter.ListofPets[index].GiveOil(); Console.WriteLine(shelter.ListofPets[index].Name + "'s oil level is " + shelter.ListofPets[index].Oil); } break; case "4": pet.Play(); Console.WriteLine("You played with " + shelter.ListofPets[index].Name); Console.WriteLine(shelter.ListofPets[index].Name + "s boredom level is " + shelter.ListofPets[index].Boredom); if (shelter.ListofPets[index].IsOrganic == true) { Console.WriteLine(shelter.ListofPets[index].Name + "s health level is " + shelter.ListofPets[index].Health); Console.WriteLine(shelter.ListofPets[index].Name + "s hunger level is " + shelter.ListofPets[index].Hunger); } else { Console.WriteLine(shelter.ListofPets[index].Name + "s oil level is " + shelter.ListofPets[index].Oil); Console.WriteLine(shelter.ListofPets[index].Name + "s performance level is " + shelter.ListofPets[index].Performance); } break; case "5": if (shelter.ListofPets[index].IsOrganic == true) { pet.SeeDoctor(); Console.WriteLine("You took " + shelter.ListofPets[index].Name + " to the doctor."); Console.WriteLine(shelter.ListofPets[index].Name + "'s health is now " + shelter.ListofPets[index].Health); } else { pet.PerformMaintenance(); Console.WriteLine("You performed maintenance on " + shelter.ListofPets[index].Name); Console.WriteLine(shelter.ListofPets[index].Name + "'s oil level is now " + shelter.ListofPets[index].Oil); Console.WriteLine(shelter.ListofPets[index].Name + "'s performance level is now " + shelter.ListofPets[index].Performance); } break; case "6": Console.WriteLine(shelter.ListofPets[index].Name); Console.WriteLine(shelter.ListofPets[index].Species); if (shelter.ListofPets[index].IsOrganic == true) { Console.WriteLine("Hunger: " + shelter.ListofPets[index].Hunger); Console.WriteLine("Health: " + shelter.ListofPets[index].Health); } else { Console.WriteLine("Oil: " + shelter.ListofPets[index].Oil); Console.WriteLine("Performance: " + shelter.ListofPets[index].Performance); } Console.WriteLine("Boredom: " + shelter.ListofPets[index].Boredom); break; case "7": Console.WriteLine("Thank you for playing with " + shelter.ListofPets[index].Name + "!"); returnToKennel = true; break; default: Console.WriteLine("Please enter a valid entry"); break; } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Console.Clear(); shelter.ListofPets[index].Tick(); //if (shelter.ListofPets[index].Health <= 0) //{ // Console.WriteLine(shelter.ListofPets[index].Name.ToUpper() + " HAS DIED!"); // returnToKennel = true; //} //else if (shelter.ListofPets[index].Performance <= 0) //{ // Console.WriteLine(shelter.ListofPets[index].Name.ToUpper() + " HAS BROKEN!"); // returnToKennel = true; //} //else if (shelter.ListofPets[index].Hunger > 100) //{ // shelter.ListofPets[index].Hunger -= 10; // Console.WriteLine(shelter.ListofPets[index].Name + " got hungry and found some food on their own."); //} //else if (shelter.ListofPets[index].Oil < 0) //{ // shelter.ListofPets[index].Oil += 10; // Console.WriteLine(shelter.ListofPets[index].Name + " got squeaky and found some oil on it's own."); //} //else if (shelter.ListofPets[index].Boredom > 100) //{ // shelter.ListofPets[index].Boredom -= 10; // Console.WriteLine(shelter.ListofPets[index].Name + " got bored and found a toy to play with."); //} //if (shelter.ListofPets[index].Health <= 0) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(X - X)"); // Console.WriteLine("c(\")(\")"); // shelter.RemovePet(index); //} //else if (shelter.ListofPets[index].Performance <= 0) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(X - X)"); // Console.WriteLine("c(\")(\")"); // shelter.RemovePet(index); //} //else if (shelter.ListofPets[index].Health < 20) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(0 ~ 0)"); // Console.WriteLine("c(\")(\")"); //} //else if (shelter.ListofPets[index].Performance <20) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(0 ~ 0)"); // Console.WriteLine("c(\")(\")"); //} //else if (shelter.ListofPets[index].Boredom > 80) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(- X -)"); // Console.WriteLine("c(\")(\")"); //} //else if (shelter.ListofPets[index].Hunger > 80) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(' O ')"); // Console.WriteLine("c(\")(\")"); //} //else if (shelter.ListofPets[index].Oil < 20) //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(' O ')"); // Console.WriteLine("c(\")(\")"); //} //else //{ // Console.WriteLine(@"(\ _ /)"); // Console.WriteLine("(' X ')"); // Console.WriteLine("c(\")(\")"); //} //Console.ReadKey(); } } }
public void CreateNewPet(Pet userPet, Organic organicPet, Robotic roboticPet, Shelter myShelter) { Console.WriteLine("\nWould you like your pet to be ..."); Console.WriteLine("1. An organic pet."); Console.WriteLine("2. A robotic pet."); string petTypeChoice = Console.ReadLine(); switch (petTypeChoice) { case "1": organicPet.MakeNewPet(); userPet = new Organic(organicPet.GetName(), organicPet.GetSpecies()); myShelter.AddPet(userPet); break; case "2": roboticPet.MakeNewPet(); userPet = new Robotic(roboticPet.GetName(), roboticPet.GetSpecies()); myShelter.AddPet(userPet); break; default: Console.WriteLine("Invalid input."); break; } }
static void Main(string[] args) { Console.WriteLine("Hello! Welcome to Virtual Pets"); Pet userPet = new Pet(); Shelter myShelter = new Shelter(); Organic organicPet = new Organic(); Robotic roboticPet = new Robotic(); Console.WriteLine("Would you like your pet to be ..."); Console.WriteLine("1. An organic pet."); Console.WriteLine("2. A robotic pet."); string petTypeChoice = Console.ReadLine(); switch (petTypeChoice) { case "1": organicPet.MakeNewPet(); userPet = new Organic(organicPet.GetName(), organicPet.GetSpecies()); myShelter.AddPet(userPet); break; case "2": roboticPet.MakeNewPet(); userPet = new Robotic(roboticPet.GetName(), roboticPet.GetSpecies()); myShelter.AddPet(userPet); break; default: Console.WriteLine("Invalid input."); break; } bool playingGame = true; while (playingGame) { Console.Clear(); foreach (Pet pet in myShelter.ListOfPets) { pet.GiveStats(); Console.WriteLine(); Console.ReadLine(); } userPet = myShelter.SelectPet(); userPet.MenuOptions(); string menuChoice = Console.ReadLine(); switch (menuChoice) { case "1": userPet.Feed(); break; case "2": userPet.QuenchThirst(); break; case "3": userPet.Play(); break; case "4": userPet.SeeDoctor(); break; case "5": Console.WriteLine($"You did nothing."); break; case "6": playingGame = false; Console.WriteLine("Thanks for playing!"); break; default: Console.WriteLine("Invalid input."); break; } userPet.Tick(); organicPet.CheckHealth(); organicPet.CheckHunger(); organicPet.CheckThirst(); userPet.CheckBoredom(); Console.WriteLine("Press any key to continue."); Console.ReadKey(); } Console.ReadLine(); }
static void Main(string[] args) { Shelter shelter = new Shelter(); Pet roboticPet = new RoboticPet(); Pet organicPet = new OrganicPet(); Console.WriteLine("Hello! Welcome to Virtual Pets, let's create an organic pet to start"); Console.WriteLine("What is your pet's name?"); organicPet.SetName(Console.ReadLine()); Console.WriteLine("What is your pet's species?"); organicPet.SetSpecies(Console.ReadLine()); Console.WriteLine($"{organicPet.GetName()} The {organicPet.GetSpecies()} exists!"); shelter.AddOrganicPet(organicPet); Console.WriteLine("Press Enter to start playing"); Console.ReadLine(); bool whilePlaying = true; do { shelter.TickAllPets(); Console.WriteLine("What do you want to do with your pet?"); Console.WriteLine("1. Feed a pet"); Console.WriteLine("2. Play with a pet"); Console.WriteLine("3. Take a pet to the vet"); Console.WriteLine("4. Check pet status"); Console.WriteLine("5. Adopt pet"); Console.WriteLine("6. Add robotic pet"); Console.WriteLine("7. Add organic pet"); Console.WriteLine("8. Review Shelter list"); Console.WriteLine("9. Feed all pets"); Console.WriteLine("10. Play with all pets"); Console.WriteLine("11. Take all pets to the vet"); Console.WriteLine("12. Quit"); string menuChoice = Console.ReadLine(); Console.Clear(); switch (menuChoice) { case "1": { shelter.PrintAllPets(); Console.WriteLine("Which pet would you like to feed?"); int petNumber = Convert.ToInt32(Console.ReadLine()); Pet petToChoose = shelter.FindPetByIndex(petNumber - 1); petToChoose.Feed(); Console.WriteLine($"You fed {petToChoose.Name}!"); petToChoose.CheckPetStatus(); break; } case "2": { shelter.PrintAllPets(); Console.WriteLine("Which pet would you like to play with?"); int petNumber = Convert.ToInt32(Console.ReadLine()); Pet petToChoose = shelter.FindPetByIndex(petNumber - 1); petToChoose.Play(); Console.WriteLine($"You played with {petToChoose.Name}!"); petToChoose.CheckPetStatus(); break; } case "3": { shelter.PrintAllPets(); Console.WriteLine("Which pet would you like to take to the vet?"); int petNumber = Convert.ToInt32(Console.ReadLine()); Pet petToChoose = shelter.FindPetByIndex(petNumber - 1); petToChoose.SeeDoctor(); Console.WriteLine($"You took {petToChoose.Name} to the vet!"); petToChoose.CheckPetStatus(); break; } case "4": { shelter.PrintAllPets(); Console.WriteLine("Which pet would you like to check up on?"); int petNumber = Convert.ToInt32(Console.ReadLine()); Pet petToChoose = shelter.FindPetByIndex(petNumber - 1); petToChoose.CheckPetStatus(); break; } case "5": { shelter.PrintAllPets(); Console.WriteLine("Which pet will be adopted? This pet will be permanently removed from the shelter"); int petNumber = Convert.ToInt32(Console.ReadLine()); Pet petToChoose = shelter.FindPetByIndex(petNumber - 1); shelter.RemovePetFromList(petToChoose); Console.WriteLine($"{petToChoose.GetName()} Found a new home :)"); break; } case "6": { roboticPet = new RoboticPet(); Console.WriteLine("What is your pet's name?"); roboticPet.SetName(Console.ReadLine()); Console.WriteLine("What is your pet's species?"); roboticPet.SetSpecies(Console.ReadLine()); shelter.AddRoboticPet(roboticPet); Console.WriteLine($"{roboticPet.GetName()} The Robo-{roboticPet.GetSpecies()} exists!"); break; } case "7": { organicPet = new OrganicPet(); Console.WriteLine("What is your pet's name?"); organicPet.SetName(Console.ReadLine()); Console.WriteLine("What is your pet's species?"); organicPet.SetSpecies(Console.ReadLine()); shelter.AddOrganicPet(organicPet); Console.WriteLine($"{organicPet.GetName()} The {organicPet.GetSpecies()} exists!"); break; } case "8": { shelter.PrintAllPetDetails(); break; } case "9": { shelter.FeedAllPets(); break; } case "10": { shelter.PlayWithAllPets(); break; } case "11": { shelter.AllPetsSeeDoctor(); break; } case "12": { whilePlaying = false; break; } default: { Console.WriteLine("Please enter a valid number"); break; } } } while (whilePlaying); }
static void Main(string[] args) { Pet myPet = new Pet(); Shelter myShelter = new Shelter(); Console.WriteLine("Hello! Welcome to Virtual Pets!"); //Console.WriteLine("What kind of pet do you want?"); //userPet.SetSpecies(Console.ReadLine()); //Console.WriteLine("Great! What should their name be?"); //userPet.SetName(Console.ReadLine()); //Console.Clear(); //Console.WriteLine("Your pet is " + userPet.GetName() + " the " + userPet.GetSpecies()); bool keepPlaying = true; while (keepPlaying) { Console.WriteLine("1. Adopt a new organic pet."); Console.WriteLine("2. Create a new robotic pet."); Console.WriteLine("3. Check boredom status of pets."); Console.WriteLine("4. Give head pats to organic pets."); //Console.WriteLine("5. Give head pats."); //Console.WriteLine("6. Play with pet."); //Console.WriteLine("7. Give organic pet a bath."); //Console.WriteLine("8. Feed organic pet."); //Console.WriteLine("9. Charge robotic pet."); //Console.WriteLine("10. Take robotic pet to shop for maintenance."); //Console.WriteLine("11. Update robotic pet's software."); string userChoice = Console.ReadLine(); switch (userChoice) { case "1": Console.WriteLine("What is the name of your pet?"); string organicPet = Console.ReadLine(); Console.WriteLine("What type of pet do you want?"); string petType = Console.ReadLine(); myPet = new OrganicPet(organicPet, petType); myShelter.AddPet(myPet); break; case "2": Console.WriteLine("What is the name of your robotic pet?"); string roboticPet = Console.ReadLine(); Console.WriteLine("What type of robotic pet do you want?"); petType = Console.ReadLine(); myPet = new RoboticPet(roboticPet, petType); myShelter.AddPet(myPet); break; case "3": foreach (Pet pet in myShelter.ListOfPets) { Console.WriteLine($"\n{pet.GetName()} the {pet.GetSpecies()} status"); //Console.WriteLine($"Hunger Level: {pet.GetHunger()}"); Console.WriteLine($"Boredom Level: {pet.GetBoredom()}"); //Console.WriteLine($"Health Level: {pet.GetHealth()}"); } break; case "4": myPet = myShelter.SelectPet(); myPet.GiveHeadPats(); Console.WriteLine($"You pet {myPet.Name}."); break; } Console.WriteLine("Press any key to continue."); Console.ReadKey(); myPet.Tick(); Console.Clear(); //Console.WriteLine("\n" + userPet.GetName() + " the " + userPet.GetSpecies() + "'s stats:"); //Console.WriteLine("\nHunger level: " + userPet.GetHunger()); //Console.WriteLine("Boredom level: " + userPet.GetBoredom()); //Console.WriteLine("Health level: " + userPet.GetHealth()); //Console.WriteLine("\nWhat do you want to do with " + userPet.GetName()); //Console.WriteLine("1. Feed"); //Console.WriteLine("2. Play"); //Console.WriteLine("3. Give head pats!"); //Console.WriteLine("4. Exit"); //string userChoice = Console.ReadLine(); //switch (userChoice) //{ // case "1": // Console.WriteLine("You fed " + userPet.GetName()); // userPet.Feed(); // break; // case "2": // Console.WriteLine("You played with " + userPet.GetName()); // userPet.Play(); // break; // case "3": // Console.WriteLine(userPet.GetName() + " feels better now"); // userPet.GiveHeadPats(); // break; // case "4": // Console.WriteLine("Thank you for playing!"); // keepPlaying = false; // break; // default: // Console.WriteLine("You have angered Horace. Please choose a proper option!"); // break; } }
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; } } }
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); }