/// <summary> /// instantiate and initialize G the Cat /// </summary> /// <param name="name">name</param> /// <returns>PetCat object</returns> static PetCat InitializePetCatG(string name) { PetCat G = new PetCat(name); G.Weight = 5.5; G.CatWasAdopted = true; G.CurrentMood = PetCat.Mood.playful; G.CatBreed = "Tabby"; return(G); }
/// <summary> /// instantiate and initialize Rue the Cat /// </summary> /// <returns>PetCat object</returns> static PetCat InitializePetCatRue() { PetCat rue = new PetCat(); rue.Name = "Rue"; rue.Weight = 2.2; rue.CatWasAdopted = true; rue.CurrentMood = PetCat.Mood.tired; rue.CatBreed = "Torti"; return(rue); }
/// <summary> /// display a screen to get a new pet cat from the user /// </summary> /// <param name="petCats">list of Cats</param> static void DisplayGetUserPetCat(List <PetCat> petCats) { // // create (instantiate) a new PetCat object // PetCat userPetCat = new PetCat(); DisplayHeader("Add a Cat"); // // get the PetCat object's property values from user // Console.Write("Enter Name:"); userPetCat.Name = Console.ReadLine(); Console.Write("Enter Weight:"); double.TryParse(Console.ReadLine(), out double weight); userPetCat.Weight = weight; Console.Write("Cat Was Adopted:"); if (Console.ReadLine().ToUpper() == "YES") { userPetCat.CatWasAdopted = true; } else { userPetCat.CatWasAdopted = false; } Console.Write("Enter Emotional State:"); Enum.TryParse(Console.ReadLine(), out PetCat.Mood emotionalState); userPetCat.CurrentMood = emotionalState; Console.Write("Enter Cat Breed:"); userPetCat.CatBreed = Console.ReadLine(); // // add PetCat object to list // petCats.Add(userPetCat); DisplayContinuePrompt(); }