static void Main(string[] args) { //This part allows the user to assignin random numbers to fields. Random random = new Random(); int Hunger = random.Next(90, 100); int Thirst = random.Next(50, 70); //PROPERTIES VirtualPet userPet = new VirtualPet(); userPet.Hunger = Hunger; userPet.Thirst = Thirst; //UI Console.WriteLine("Welcome to the Virtual Pet Shelter!\n Please enter your employee type \n 1- for Manager \n 2- for Volunteer."); Console.WriteLine(" Great! - Press any key to view pets status and choose further action..."); Console.ReadLine(); Console.Clear(); do { userPet.GetStatus(); //if (userImput ==1) //USER MENU 1 (Manager Menu) Console.WriteLine("What would you like to do?"); Console.WriteLine("\tPress 1 to feed {0}.", userPet.PetsName); Console.WriteLine("\tPress 2 to give {0} water.", userPet.PetsName); Console.WriteLine("\tPress 3 to play with {0}.", userPet.PetsName); Console.WriteLine("\tPress 4 to adopt {0}.", userPet.PetsName); Console.WriteLine("\tPress 5 to quit the game."); int userChoice = int.Parse(Console.ReadLine()); while (userChoice < 1 || userChoice > 5) { Console.WriteLine("You must choose 1 - 4 from the menu!\nWhat do you want to do for your pets?"); userChoice = int.Parse(Console.ReadLine()); } switch (userChoice) { case 1: { userPet.FeedPet(); } break; case 2: { userPet.WaterPet(); } break; case 3: { userPet.PlayWithPet(); break; } case 4: { Console.WriteLine("{0} says, \"Has been adopted!\"", userPet.PetsName); Console.WriteLine("the pets are very happy"); Environment.Exit(0); } break; case 5: { Console.WriteLine("{0} says, \"What a great worker!\"", userPet.PetsName); Console.WriteLine("the pets are very happy"); Environment.Exit(0); } break; // else (userImput == 2) // USER MENU 2 - Volunteer Menu goes here with additional switch case dialogue } Console.WriteLine("Press any key to continue"); Console.ReadLine(); } while (userPet.PetHappiness <= 75); //this section is what prints to the console when the virtual puppy's satisfaction is greater than or equal to 75). //Console.WriteLine("\nCongratulations {0}!\nYou have made {1} very happy today!\nThanks for playing Virtual Pet Shelter!", userPet.PetsName); } //MAIN
static void Main(string[] args) { string food = string.Empty; string water = string.Empty; string play = string.Empty; VirtualPet Godzooky = new VirtualPet(); Random rnd = new Random(); int hungerLevel = rnd.Next(1, 17); int thirstLevel = rnd.Next(1, 18); int boredomLevel = rnd.Next(1, 18); Console.WriteLine("Welcome to Michael's VirtualPet Project"); Console.WriteLine(" Hi, I'm Godzilla's kid, {0} ", Godzooky.name, "lets have fun"); int n = 10; int results = 1; while (true) { results *= n; n--; { int result = Environment.TickCount & Int32.MaxValue; Console.WriteLine("TickCount: {0}", result); } Console.WriteLine(" choose 0 Pet Option, it will pause the Virtual Pet "); Console.WriteLine(" choose 1 Pet Option, it will feed {0} ", Godzooky.Name); Console.WriteLine(" choose 2 Pet Option, it will give {0} some water", Godzooky.Name); Console.WriteLine(" choose 3 Pet Option,{0} will talk to you", Godzooky.Name); Console.WriteLine(" choose 4 Pet Option, you can play with {0} ", Godzooky.Name); Console.WriteLine(" choose 5 Pet Option, you can quit the program "); Console.WriteLine(" TYPE your Pet Option as a number 0, 1, 2, 3, 4 or, 5 "); int petOptions = int.Parse(Console.ReadLine()); switch (petOptions) { case 0: Console.WriteLine("OK, I'm gonna take a nap "); Thread.Sleep(0); break; case 1: Console.WriteLine("You fed {0} ", Godzooky.Name); Godzooky.Eat(food); break; case 2: Console.WriteLine("{0} drank some water ", Godzooky.Name); Godzooky.Drink(water); break; case 3: Console.WriteLine(" {0}spoke ", Godzooky.Name); Godzooky.Speak(); break; case 4: Console.WriteLine(" You played with {0} ", Godzooky.Name); Godzooky.Boredom(play); break; case 5: Console.WriteLine(" You're gonna miss out on a lot of fun, goodbye "); Environment.Exit(0); break; default: Console.WriteLine(" Invalid selection "); Console.WriteLine(" Please choose Pet Option 0, 1, 2, 3, 4, or, 5 "); 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); }
public void AddPetToShelter(VirtualPet myCat) { myPetList.Add(new VirtualPet(myCat.Name, myCat.Species)); }