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) { Random random = new Random(); //organic pet int startHunger = random.Next(50, 70); int startEnergy = random.Next(50, 60); int startHealth = random.Next(30, 50); //robot pet int startGasLevel = random.Next(10, 50); int startOilLevel = random.Next(30, 60); int startCharger = random.Next(5, 20); Pet pet = new Pet(); OrganicPet organicPet = new OrganicPet(); organicPet.Health = startHealth; organicPet.Hunger = startHunger; organicPet.Energy = startEnergy; RobotPet robotPet = new RobotPet(); robotPet.GasLevel = startGasLevel; robotPet.OilLevel = startOilLevel; robotPet.Charger = startCharger; bool VirtualPet = true; do { organicPet.Tick(); Console.WriteLine("Welcome to Pixel Pet!\n"); Console.WriteLine("What do you want to do?"); Console.WriteLine("1. Pick your species of pet"); Console.WriteLine("2. Name your pet!"); Console.WriteLine("3. Feed your pet"); Console.WriteLine("4. Play with your pet"); Console.WriteLine("5. Take pet to the doctor"); Console.WriteLine("6. Visit the pet shelter!"); Console.WriteLine("7. Check the status of you pet"); Console.WriteLine("8. Exit game."); string userChoice = Console.ReadLine().ToLower(); Console.Clear(); switch (userChoice) { case "1": Console.WriteLine("What species of animal would you like?"); string speciesOfPet = Console.ReadLine(); pet.SetSpecies(speciesOfPet); Console.WriteLine($"The species of your animal is: {pet.Species}\n"); break; case "2": Console.WriteLine("What would you like to name your pet?"); string nameOfPet = Console.ReadLine(); pet.SetName(nameOfPet); Console.WriteLine("\n"); Console.WriteLine($"Congratulations! \nThe name of your pet is: {pet.Name}\n"); break; case "3": organicPet.Feed(); Console.WriteLine($"Would you like to feed {pet.Name}?"); Console.WriteLine($"{pet.Name} hunger levels are:{organicPet.Hunger}\n"); break; case "4": organicPet.Play(); Console.WriteLine($"Would you like to play with {pet.Name}?"); Console.WriteLine($"{pet.Name} boredom levels are:{organicPet.Energy}\n"); break; case "5": organicPet.SeeDoctor(); Console.WriteLine($"Would you like to take care of {pet.Name}?"); Console.WriteLine($"{pet.Name} Health levels are:{organicPet.Health}\n"); break; case "6": Console.WriteLine("Welcome to the Pixel Pet Shelter!!"); break; case "7": Console.WriteLine("Check overall status of pet:\n"); Console.WriteLine($"The name of your pet is {pet.Name} with a species type of {pet.Species}"); Console.WriteLine($"Hunger: {organicPet.Hunger}"); Console.WriteLine($"Boredom: {organicPet.Energy}"); Console.WriteLine($"Health: {organicPet.Health}"); break; case "8": VirtualPet = false; Console.WriteLine("Good bye!"); break; default: Console.WriteLine("Please enter a valid number."); break; } Console.WriteLine("Return to main menu\n"); Console.ReadKey(); Console.Clear(); } while (VirtualPet); }
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 static void Main(string[] args) { string userSelection; string userPetSelection; Pet myPet = new Pet(); OrganicPet myOrganicPet = new OrganicPet(); RoboticPet myRoboticPet = new RoboticPet(); VirtualPetShelter myShelter = new VirtualPetShelter(); bool exitGame = false; do { myOrganicPet.PetMenu(); userSelection = Console.ReadLine(); switch (userSelection) { case "1": Console.WriteLine("Please Select whether you want to add an organic pet or a robotic pet: "); Console.WriteLine("1- Organic Pet"); Console.WriteLine("2- Robotic Pet"); userPetSelection = Console.ReadLine(); switch (userPetSelection) { case "1": myPet = new OrganicPet(); myPet.AddPet(); myShelter.AddPetToShelter(myPet); ScreenClear(); break; case "2": myPet = new RoboticPet(); myPet.AddPet(); myShelter.AddPetToShelter(myPet); /*myRoboticPet = new RoboticPet(); * myRoboticPet.AddRoboticPet(); * myShelter.AddRoboticPetToShelter(myRoboticPet);*/ ScreenClear(); break; } break; case "2": myShelter.ListPetSelection(); myPet = myShelter.SelectPet(); Console.WriteLine($"You are now interacting with {myPet.PetName}"); ScreenClear(); break; case "3": myShelter.ShowAllPetsInfo(); ScreenClear(); break; case "4": myShelter.ShowAllPetsStatus(); ScreenClear(); break; case "5": Console.WriteLine("Please select a number from the following: "); Console.WriteLine("1- Feed single pet"); Console.WriteLine("2- Feed all pets in shelter"); userSelection = Console.ReadLine(); ScreenClear(); switch (userSelection) { case "1": myPet.FeedPet(); break; case "2": myShelter.FeedAllPets(); break; } break; case "6": Console.WriteLine("Please select a number from the following: "); Console.WriteLine("1- Play with a single pet"); Console.WriteLine("2- Play with all pets in shelter"); userSelection = Console.ReadLine(); ScreenClear(); switch (userSelection) { case "1": myPet.PlayWithPet(); break; case "2": myShelter.PlayWithAllPets(); break; } break; case "7": Console.WriteLine("Please select a number from the following: "); Console.WriteLine("1- Take one pet to the doctor"); Console.WriteLine("2- Take all pets to the doctor"); userSelection = Console.ReadLine(); ScreenClear(); switch (userSelection) { case "1": myPet.TakeToDoctor(); break; case "2": myShelter.TakeAllPetsToDoctor(); break; } break; case "8": exitGame = true; break; } } while (exitGame == false); }
public void AddOrganicPetToShelter(OrganicPet organicPet) { organicPetsInShelter.Add(organicPet); }
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); }
public static void Main(string[] args) { bool stillPlaying = true; Pet newPet = new Pet(); RoboticPet roboticPet = new RoboticPet(); OrganicPet organicPet = new OrganicPet(); PetShelter myShelter = new PetShelter(); while (stillPlaying) { myShelter.TickOnAllPets(); Console.WriteLine("\n\tHello! Welcome to Virtual Pets"); Console.WriteLine("\n"); Console.WriteLine("\t1. View list of pets."); Console.WriteLine("\t2. Bringing in a new pet?"); Console.WriteLine("\t3. Select a certain pet to interact with."); Console.WriteLine("\t4. Feed your pet(s)."); Console.WriteLine("\t5. Give your pet(s) water."); Console.WriteLine("\t6. Your pet(s) bored, let's play."); Console.WriteLine("\t7. Time for a checkup with the vet."); Console.WriteLine("\t8. Adopt a pet!\n"); Console.WriteLine($"\n\tYou are currently interacting with " + newPet.Name); Console.WriteLine("\n\t Press 'Q' to Exit game."); Console.WriteLine("\tPress enter to return to the Main Menu\n"); string userChoice = Console.ReadLine().ToLower(); Console.Clear(); switch (userChoice) { case "1": myShelter.PrintAllPetsList(); Console.Clear(); break; case "2": Console.WriteLine("\tEnter 1' [Organic Pet] or '2' [Robotic Pet]."); string petChoice = Console.ReadLine(); switch (petChoice) { case "1": myShelter.PrintAllPetsList(); organicPet = new OrganicPet(); organicPet.CreatePet(); myShelter.AddPet(organicPet); break; case "2": myShelter.PrintAllPetsList(); roboticPet = new RoboticPet(); roboticPet.CreatePet(); myShelter.AddPet(roboticPet); break; default: break; } break; case "3": myShelter.PrintAllPetsList(); Console.WriteLine("Select pet by number to view."); newPet = myShelter.FindAnimalByIndex(); break; case "4": Console.WriteLine("\tEnter 1' [To feed one pet] or '2' [Feed all pets]."); string feedChoice = Console.ReadLine(); switch (feedChoice) { case "1": newPet.Feed(); Console.WriteLine($"\tYou fed {newPet.Name}"); break; case "2": myShelter.FeedAll(); Console.WriteLine($"\tYou fed all the animals in the shelter!"); break; default: break; } break; case "5": Console.WriteLine("\tPress '1' [To quench one pet's thirst] or press '2' [For all pets]."); string thirstChoice = Console.ReadLine(); switch (thirstChoice) { case "1": newPet.GiveWater(); Console.WriteLine($"\tYou gave {newPet.Name} somthing to drink"); break; case "2": myShelter.WaterAll(); Console.WriteLine($"\tYou gave all your animals something to drink."); break; default: break; } break; case "6": Console.WriteLine("\tPress '1'[Play with one pet] or press '2' [Play with all pets]."); string playChoice = Console.ReadLine(); switch (playChoice) { case "1": newPet.Play(); Console.WriteLine($"\tYou played with {newPet.Name}"); break; case "2": myShelter.PlayWithAll(); Console.WriteLine($"\tYou played with all the animals."); break; default: break; } break; case "7": Console.WriteLine("\tPress '1' [To take one pet] or press '2' [To take all pets]."); string healthChoice = Console.ReadLine(); Console.Clear(); switch (healthChoice) { case "1": newPet.SeeDoctor(); Console.WriteLine($"{ newPet.Name} is feeling much better!"); break; case "2": myShelter.SeeDoctorAll(); break; default: break; } break; case "8": myShelter.PrintAllPetsList(); Console.WriteLine("\n\tWho do you want to adopt?"); Pet petToRemove = myShelter.FindAnimalByIndex(); myShelter.AdoptPet(petToRemove); Console.WriteLine(newPet.Name + $"said yes!! You'll make a great pet parent!"); break; case "q": Console.ReadLine().ToLower(); break; default: break; } } }
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; } }