- The console accepts input for a new animal and adds that animal to the zoo.
ConsoleHelper and ConsoleUtil classes, as specified in the diagram below.
Console.Util. You will need to add a using.public static string GetTypes(Type type)
{
StringBuilder typeList = new StringBuilder();
foreach(string at in Enum.GetNames(type))
{
typeList.Append(at + "|");
}
return "|" + typeList.ToString();
}ReadAlphabeticValue method uses the ReadStringValue method to prompt the user for a value, passing in the type of thing to look for (ex: Animal type, Name, Gender, etc).Then, it checks if the return only contains letters and spaces. It contains the following code:
string result = null;
bool found = false;
while (!found)
{
result = ConsoleUtil.ReadStringValue(prompt);
if (Regex.IsMatch(result, @"^[a-zA-Z ]+$"))
{
found = true;
}
else
{
Console.WriteLine(prompt + " must contain only letters or spaces.");
}
}
return result;ReadStringValue method prompts the user for a value using the passed in prompt parameter, trims and lower cases the return from the Console and ensures that a value was entered.It contains the following code:
string result = null;
bool found = false;
while (!found)
{
Console.Write(prompt + "] ");
string stringValue = Console.ReadLine().ToLower().Trim();
if (stringValue != string.Empty)
{
result = stringValue;
found = true;
}
else
{
Console.WriteLine(prompt + " must have a value.");
}
}
return result;ReadIntValue method uses the ReadStringValue method to prompt the user for a value, then takes that values and checks if it is a whole number.It contains the following code:
int result = 0;
string stringValue = result.ToString();
bool found = false;
while (!found)
{
stringValue = ConsoleUtil.ReadStringValue(prompt);
if (int.TryParse(stringValue, out result))
{
found = true;
}
else
{
Console.WriteLine(prompt + " must be a whole number.");
}
}
return result;ReadDoubleValue method uses the ReadStringValue method to prompt the user for a value, then takes that value and checks if it is a double.It contains the following code:
double result = 0.0;
string stringValue = result.ToString();
bool found = false;
while (!found)
{
stringValue = ConsoleUtil.ReadStringValue(prompt);
if (double.TryParse(stringValue, out result))
{
found = true;
}
else
{
Console.WriteLine(prompt + " must be either a whole number or a decimal number.");
}
}
return result;ReadGender method uses the ReadStringValue method to prompt the user for a value and attempts to convert it to an enumeration value.It contains the following code:
Gender result = Gender.Female;
string stringValue = result.ToString();
bool found = false;
while (!found)
{
stringValue = ConsoleUtil.ReadAlphabeticValue("Gender");
stringValue = ConsoleUtil.InitialUpper(stringValue);
if (Enum.TryParse<Gender>(stringValue, out result))
{
found = true;
}
else
{
Console.WriteLine("Invalid gender. Possible gender types: " + GetTypes(typeof(Gender)));
}
}
return result;
"add".ConsoleHelper's ProcessAddCommand method.commandWords array, which represents the type of object the user wants to add (e.g. "animal").ProcessAddCommand method."animal" and default.AddAnimal in the "animal" case.ConsoleHelper's AddAnimal method.The sequence of method calls will end up looking like the diagram below.

ReadAlphabeticValue, pass "Name" as the argument.ReadIntValue, pass "Age" as the argument.ReadDoubleValue, pass "Weight" as the argument.Animal class to public by removing the protected modifier.Pass in any values you want for the age, name, weight, and gender.
ReadAlphabeticValue method.InitialUpper method to ensure the Dingo's name has the first letter uppercased.Gender to the result of calling the ReadGender method.ReadIntValue method, passing in "Age".ReadDoubleValue method, passing in "Weight".Gender: MaleConsoleHelper called AddGuest.It takes a zoo as a parameter and returns void. Add a case in ProcessAddCommand for "guest" and call the AddGuest method in it.

AddGuest method in a similar way to the AddAnimal command.Create a guest and then prompt the user for the following properties. You will need to create a method to read the wallet color enum.
GenderA Name prompt should appear. Typing the following values for the various properties should result in the guest being added to the zoo and shown to the console.
Gender: MaleThe console should continuously ask the user to enter a value while the value is invalid.
AnimalFactory and the AnimalType enum in the Animals project, as specified in the diagram below.
CreateAnimal method.null.AnimalType enum.AnimalType enum in it and then create a Factories folder and put the AnimalFactory class in it.NewZoo static method in the Zoo class, use the static CreateAnimal method to instantiate the animals.For example:
comoZoo.AddAnimal(AnimalFactory.CreateAnimal(AnimalType.Chimpanzee, "Bobo", 3, 50.0, Gender.Male));ConsoleUtil called ReadAnimalType. It takes no parameters and returns an AnimalType.ReadAnimalType method, add a call to the GetTypes method and pass in a typeof AnimalType.Console.WriteLine("Invalid animal type. Possible animal types: " + GetTypes(typeof(AnimalType)));ReadGender method, do the same thing to return the gender types.ReadWalletColor method, do the same thing to return the wallet color types.AddAnimal method in the ConsoleHelperCreateAnimal method.Pass in the animal type returned from the ReadAnimalType method for the first parameter.
Ensure you get an error message that displays the list of animal types to instantiate.
'help'. Information about the add command should appear.MainWindow named 'animalTypeComboBox'.windowLoaded event handler, assign the animalTypeComboBox's ItemsSource property toEnum.GetValues(typeof(AnimalType))addAnimalButton_Click event handlerAnimalType and assign it to the animalComboBox's SelectedItem property and cast it as an AnimalType.(AnimalType)this.animalTypeComboBox.SelectedItemAnimalFactory's CreateAnimal method and pass in the animal type returned from the combo box.AnimalWindow.NullRefereceException.In the catch, show a MessageBox with a message telling the user an animal must be selected before adding an animal to the zoo.
AnimalWindow's window_Loaded event handler to a ternary expression using the code below.this.pregnancyStatusLabel.Content = this.animal.IsPregnant ? "Yes" : "No";The default values passed into the CreateAnimal method should appear in the AnimalWindow.
Console commands remove the requested animals and guests.RemoveAnimal method based on the class diagram below.Inside the method it should call the Remove method on the animals list, passing in the animal parameter.

ConsoleHelper class as specified in the diagram below.
Program.cs."remove".
ProcessRemoveCommand method.Pass in the zoo and the second and third items in the commandWords array.
ProcessRemoveCommand method in the ConsoleHelper"animal" and default.RemoveAnimal in the "animal" case and pass in the uppercased name parameter.RemoveAnimal methodnull, write a statement to the console saying that the animal could not be found.RemoveGuest method to the ZooYou'll need to also add a RemoveGuest method to the ConsoleHelper and a case for "guest" in the ProcessRemoveCommand method.

RemoveAnimal and RemoveGuest. Run the console application.Console Application© 2026 Northcentral Technical College