1.4 Zoo Learning Activity

Overview
1.Prepare for Zoo 1.4
A Parameters and Simple Decisions

In Zoo 1.3, many methods performed one fixed action. In Zoo 1.4, you will make those actions more flexible by passing values into methods. You will use parameters, arguments, local variables, and simple one-way if statements so feeding, money movement, pregnancy state, and birthing-room temperature can respond to the current situation.

B Getting Started
1 After backing up, rename the Zoo 1.3 LastName folder and .sln to Zoo 1.4 LastName
C Starting Point — End of Zoo 1.3

Zoo 1.4 begins with the completed Zoo 1.3 structure. The diagram below is the baseline for the changes in this checkpoint.

Zoo 1.3 ending class structure used as the starting point for Zoo 1.4. MainWindow references the Como and San Diego Zoo objects. Zoo references its featured Animal, BirthingRoom, VendingMachine, and Guest; Guest references Wallet. Existing Zoo 1.3 methods include parameterless Eat, AddMoney, SellFood, and RemoveMoney behaviors.
Starting structure: authoritative end-of-Zoo-1.3 context.
  • New
  • Changed
  • Removed
Use the Current Amounts for Guest Money and Animal Feeding
2.Calculate the Food Amount and Purchase Cost for the Current Animal
A Calculate the food amount
1 In MainWindow.xaml.cs, inside darlaFeedDingoButton_Click, add the foodWeight local variable:
double foodWeight =
    this.ComoZoo.FeaturedAnimal.Weight *
    this.ComoZoo.FeaturedAnimal.PortionSizePercentage;
2 In MainWindow.xaml.cs, inside daveFeedPlatypusButton_Click, calculate foodWeight using the San Diego featured animal:
double foodWeight =
    this.SanDiegoZoo.FeaturedAnimal.Weight *
    this.SanDiegoZoo.FeaturedAnimal.PortionSizePercentage;
B Calculate the food cost
1 Immediately below foodWeight in darlaFeedDingoButton_Click, add the foodCost local variable:
decimal foodCost =
    (decimal)foodWeight *
    this.ComoZoo.AnimalSnackMachine.FoodPricePerPound;
2 Immediately below foodWeight in daveFeedPlatypusButton_Click, calculate foodCost using the San Diego vending-machine price:
decimal foodCost =
    (decimal)foodWeight *
    this.SanDiegoZoo.AnimalSnackMachine.FoodPricePerPound;
C Check Your Work
1 Set a breakpoint on the decimal foodCost = statement in darlaFeedDingoButton_Click.
2 Click New Como Zoo to reset that zoo. Do not feed, refill, move or give birth before this test.
3 Click Darla, feed dingo. In Watch, confirm foodWeight is approximately 0.706.
4 Press F10 to complete the cost assignment. Confirm foodCost is 0.5295m.
5 Continue and remove that breakpoint. Set the equivalent breakpoint in daveFeedPlatypusButton_Click.
6 Click New San Diego Zoo to reset that zoo. Do not feed, refill, move or give birth before this test.
7 Click Dave, feed platypus. Confirm foodWeight is approximately 0.0654.
8 Press F10. Confirm foodCost is 0.07848m.
9 Press F5 to continue. Stop debugging and remove the breakpoint before the next check.
3.Pass Money Amounts Through the Guest and Wallet Behaviors
A Update Guest money methods
1 In Guest.cs, update Guest.AddMoney to receive a decimal amount parameter and forward that value to Wallet.AddMoney:
public void AddMoney(decimal amount)
{
    this.Wallet.AddMoney(amount);
}
2 In Guest.cs, update Guest.RemoveMoney to receive a decimal amount parameter and forward that value to Wallet.RemoveMoney:
public void RemoveMoney(decimal amount)
{
    this.Wallet.RemoveMoney(amount);
}
B Update Wallet money methods
1 In Wallet.cs, update Wallet.AddMoney so it receives a decimal amount and adds the amount when it is greater than 0:
public void AddMoney(decimal amount)
{
    if (amount > 0)
    {
        this.MoneyBalance += amount;
    }
}
2 In Wallet.cs, update Wallet.RemoveMoney so it receives a decimal amount and subtracts the amount when the wallet has enough money:
public void RemoveMoney(decimal amount)
{
    if (amount <= this.MoneyBalance)
    {
        this.MoneyBalance -= amount;
    }
}
C Send the calculated cost to Guest
1 Back in MainWindow.xaml.cs, inside darlaFeedDingoButton_Click, pass foodCost to Guest.RemoveMoney:
this.ComoZoo.Visitor.RemoveMoney(foodCost);
2 Inside daveFeedPlatypusButton_Click, pass the San Diego foodCost to Guest.RemoveMoney:
this.SanDiegoZoo.Visitor.RemoveMoney(foodCost);
D Check Your Work
1 Set a breakpoint on the payment call in darlaFeedDingoButton_Click.
2 Click New Como Zoo to reset that zoo. Do not feed, refill, move or give birth before this test.
3 Click Darla, feed dingo. At the breakpoint confirm this.ComoZoo.Visitor.Wallet.MoneyBalance is 5.25m and foodCost is 0.5295m.
4 Press F11 into Guest.RemoveMoney. Confirm its amount parameter is 0.5295m.
5 Press F11 into Wallet.RemoveMoney. Confirm its amount is also 0.5295m.
6 Step past the subtraction with F10. Confirm this.MoneyBalance is 4.7205m.
7 Repeat from a new San Diego Zoo. Confirm the forwarded amount is 0.07848m and Dave’s this.MoneyBalance ends at 3.67152m.
8 Press F5 to continue. Stop debugging and remove the breakpoint before the next check.
4.Pass the Transaction Amounts to the Vending Machine
A Update VendingMachine methods
1 In VendingMachine.cs, update VendingMachine.AddMoney to receive a decimal amount parameter and add it to MoneyBalance:
public void AddMoney(decimal amount)
{
    this.MoneyBalance += amount;
}
2 In VendingMachine.cs, replace the fixed food-sale behavior with RemoveFood(double amount):
public void RemoveFood(double amount)
{
    this.FoodStock -= amount;
}
B Pass the current calculated values
1 In MainWindow.xaml.cs, inside darlaFeedDingoButton_Click, pass the same calculated values to the vending machine:
this.ComoZoo.AnimalSnackMachine.AddMoney(foodCost);
this.ComoZoo.AnimalSnackMachine.RemoveFood(foodWeight);
2 Inside daveFeedPlatypusButton_Click, pass the same San Diego transaction values to the vending machine:
this.SanDiegoZoo.AnimalSnackMachine.AddMoney(foodCost);
this.SanDiegoZoo.AnimalSnackMachine.RemoveFood(foodWeight);
C Check Your Work
1 Read the updated VendingMachine.AddMoney and VendingMachine.RemoveFood source. Trace the following cases independently, using a starting this.FoodStock of 250.0 and this.MoneyBalance of 0.00m.
2 For the Como sale, use food weight 0.706 and payment 0.5295m. Confirm this.FoodStock becomes approximately 249.294.
3 Confirm this.MoneyBalance is 0.5295m.
4 For a separate San Diego sale, use food weight 0.0654 and payment 0.07848m. Confirm this.FoodStock becomes approximately 249.9346.
5 Confirm this.MoneyBalance is 0.07848m.
5.Feed the Animal With the Same Food Amount Used by the Transaction
A Update Animal.Eat
1 In Animal.cs, update Animal.Eat to receive double foodWeight, calculate weightGain, and add the result to Weight:
public void Eat(double foodWeight)
{
    double weightGain =
        foodWeight * this.EatWeightGainPercentage;

    this.Weight += weightGain;
}
B Pass foodWeight from the feeding handler
1 In MainWindow.xaml.cs, inside darlaFeedDingoButton_Click, pass foodWeight to Animal.Eat:
this.ComoZoo.FeaturedAnimal.Eat(foodWeight);
2 In Guest.cs, update Guest.Eat so its method signature receives double foodWeight:
public void Eat(double foodWeight)
{
    // No state change is needed for this example.
}
3 Inside daveFeedPlatypusButton_Click, pass foodWeight to the San Diego featured animal:
this.SanDiegoZoo.FeaturedAnimal.Eat(foodWeight);
C Check Your Work
1 Open Animal.Eat in the source. Follow its statements from top to bottom using the sample values below; this is a paper/source trace, so do not run or edit the application for this check.
2 For Dolly, start this.Weight at 35.3 and use foodWeight of 0.706. Confirm the adult weight gain is approximately 0.5648.
3 Confirm Dolly’s this.Weight becomes approximately 35.8648.
4 For a separate Patti trace, start this.Weight at 3.27 and use foodWeight of 0.0654. Confirm her gain is approximately 0.05232 and ending weight approximately 3.32232.
6.Trace Arguments and Parameters Through the Transaction
A Use the debugger to follow the values as each method call begins. Focus on the difference between the expression or variable supplied by the caller and the parameter name used by the called method
Sequence diagram showing MainWindow passing foodCost to Guest.RemoveMoney, Guest forwarding the amount parameter to Wallet.RemoveMoney, MainWindow passing foodCost to VendingMachine.AddMoney, and foodWeight to VendingMachine.RemoveFood and Animal.Eat. No return messages are shown.
The same calculated values move through several void method calls as arguments and parameters.
  • New
  • Changed
  • Removed
B In MainWindow.xaml.cs, place a breakpoint on "this.ComoZoo.Visitor.RemoveMoney(foodCost);" inside darlaFeedDingoButton_Click
C In Guest.cs, place a breakpoint on "this.Wallet.RemoveMoney(amount);" inside RemoveMoney(decimal amount)
D In Wallet.cs, place a breakpoint on "if (amount <= this.MoneyBalance)" inside RemoveMoney(decimal amount)
E In VendingMachine.cs, place a breakpoint on "this.MoneyBalance += amount;" inside AddMoney(decimal amount)
F In VendingMachine.cs, place a breakpoint on "this.FoodStock -= amount;" inside RemoveFood(double amount)
G In Animal.cs, place a breakpoint on the line that starts with "double weightGain =" inside Eat(double foodWeight)
H Run one feeding action and inspect the value each time execution stops. Compare the argument used by the caller with the parameter inside the method
Keep Pregnancy and Feeding State Consistent for the Animal
Acceptance Criteria
  • Animal uses an Animal Baby field rather than a Boolean pregnancy field;
  • null represents the state where no unborn animal exists;
  • MakePregnant() creates a Baby only when the field is null;
  • Baby values are assigned directly without a custom Initialize(...) method;
  • the Baby uses the parent's current animal type;
  • Eat(double foodWeight) updates the adult;
  • the Baby is updated only when Baby != null;
  • all decisions remain simple one-way if statements.
7.Represent the Unborn Animal With an Animal Reference
A Replace Boolean pregnancy state with a Baby reference
1 In Animal.cs, replace the Boolean pregnancy field with an Animal field named Baby:
public Animal Baby;
B Keep the current percentages on Animal
1 In Animal.cs, use these percentage fields for the current feeding and baby calculations:
public double EatWeightGainPercentage = 0.8;
public double EatBabyWeightGainPercentage = 0.1;
public double PortionSizePercentage = 0.02;
public double BabyWeightPercentage = 0.1;
Class diagram for Animal showing a Baby field whose type is Animal, a Weight field of type double, an Eat method with a double foodWeight parameter and void return type, and a void MakePregnant method.
Animal can hold a reference to another Animal through Baby, and Eat receives the food amount through a parameter.
  • New
  • Changed
  • Removed
C Check Your Work
1 Open Animal.cs. Confirm Animal.Baby is declared with type Animal.
2 Follow the creation of a new animal before MakePregnant() runs. Confirm its Baby reference begins as null.
3 Confirm the new pregnancy representation uses Baby rather than storing a separate IsPregnant Boolean.
8.Create a Baby Only When One Does Not Already Exist
A Guard creation with a null check
1 In Animal.cs, update MakePregnant() so it creates and initializes a baby only when Baby is null:
if (this.Baby == null)
{
    this.Baby = new Animal();
    this.Baby.Sex = "Male";
    this.Baby.Name = string.Empty;
    this.Baby.Age = 0;
    this.Baby.Weight =
        this.Weight * this.BabyWeightPercentage;
    this.Baby.Type = this.Type;
}
Activity diagram for MakePregnant. The flow checks whether Baby is null. If yes, it creates a new Animal, assigns it to Baby, and sets the baby's starting values. If no, the existing Baby reference is kept. Both paths end.
MakePregnant creates a baby only when the Baby reference is null.
  • New
  • Changed
  • Removed
B Verify the one-way decision
1 Use Dolly as the current Como check: parent Weight 35.3 and this.ComoZoo.FeaturedAnimal.BabyWeightPercentage = 0.1 should create a baby Weight of 3.53
2 Confirm the new baby has Sex Male, Age 0, and Type Dingo
3 Call MakePregnant() again and confirm the existing Baby object is preserved rather than replaced
9.Update the Baby Only When the Reference Exists
A Keep the adult weight calculation
B Update the baby only when it exists
1 In Animal.cs, update Eat(double foodWeight) so the adult always gains weight and the baby gains weight only when Baby is not null:
double weightGain =
    foodWeight * this.EatWeightGainPercentage;

this.Weight += weightGain;

if (this.Baby != null)
{
    double babyWeightGain =
        foodWeight * this.EatBabyWeightGainPercentage;

    this.Baby.Weight += babyWeightGain;
}
C Check Your Work
1 Open Animal.Eat in the source. Follow its statements from top to bottom using the sample values below; this is a paper/source trace, so do not run or edit the application for this check.
2 For Dolly, use this.Weight of 35.3, foodWeight of 0.706 and this.Baby.Weight of 3.53.
3 Confirm the adult gain is approximately 0.5648 and this.Weight becomes approximately 35.8648.
4 Confirm the baby gain is approximately 0.0706 and this.Baby.Weight becomes approximately 3.6006.
5 Trace a separate call where this.Baby is null. Confirm the baby-specific block is skipped and no this.Baby.Weight access is attempted.
Adjust the San Diego Birthing-Room Temperature
Acceptance Criteria
  • the San Diego portion of the UI displays the current birthing-room temperature;
  • there is an increase control and a decrease control;
  • both controls call the same temperature-changing method;
  • the method receives a double temperatureChange parameter;
  • the decrease action supplies the negative form of the current increment;
  • a local variable stores the previous temperature;
  • the current temperature changes by the supplied amount;
  • the display is refreshed after each change.
10.Provide Controls for Increasing and Decreasing the Current Temperature
A Add the supplied temperature controls

In MainWindow.xaml, inside sanDiegoZooStackPanel , place this supplied block after the Betty fill-vending-machine button and before StackPanel.Resources . You are not expected to construct these controls from memory.

1 Add the supplied San Diego temperature-control XAML exactly as shown:
<TextBlock Text="Birthing room temperature:" Grid.Column="1" Margin="3,10,3,0"/>
<StackPanel Orientation="Horizontal">
    <Button x:Name="decreaseSanDiegoTemperatureButton" Height="25" Width="25" FontSize="16" FontWeight="Bold" Content="-" Click="decreaseSanDiegoTemperatureButton_Click"/>
    <TextBlock x:Name="temperatureTextBlock" Padding="5" Margin="3" Width="32"/>
    <Button x:Name="increaseSanDiegoTemperatureButton" Height="25" Width="25" FontSize="16" FontWeight="Bold" Content="+" Click="increaseSanDiegoTemperatureButton_Click"/>
</StackPanel>
B Show the current temperature
1 Inside newSanDiegoZooButton_Click, immediately after this.CreateSanDiegoZoo();, display the current birthing-room temperature with one decimal place:
this.temperatureTextBlock.Text =
    this.SanDiegoZoo.BirthArea.Temperature.ToString("0.0");
2 For the current checkpoint, the initial display should show 77.0 with one decimal place
11.Pass the Requested Temperature Change Into One Behavior
A Keep the application-level increment
1 In MainWindow.xaml.cs, add the application-level temperature increment field:
public double TemperatureIncrement = 0.5;
B Use the same method for both directions
1 Inside decreaseSanDiegoTemperatureButton_Click, pass the negative increment and then refresh the displayed temperature:
this.ChangeSanDiegoTemperature(-this.TemperatureIncrement);
this.temperatureTextBlock.Text =
    this.SanDiegoZoo.BirthArea.Temperature.ToString("0.0");
2 Inside increaseSanDiegoTemperatureButton_Click, pass the positive increment and then refresh the displayed temperature:
this.ChangeSanDiegoTemperature(this.TemperatureIncrement);
this.temperatureTextBlock.Text =
    this.SanDiegoZoo.BirthArea.Temperature.ToString("0.0");
3 In MainWindow.xaml.cs, add this method signature for ChangeSanDiegoTemperature:
public void ChangeSanDiegoTemperature(double temperatureChange)
12.Calculate the New Temperature From the Current State
A Store the previous temperature
1 Inside ChangeSanDiegoTemperature(double temperatureChange), store the current temperature in previousTemperature and then apply the requested change:
double previousTemperature =
    this.SanDiegoZoo.BirthArea.Temperature;

this.SanDiegoZoo.BirthArea.Temperature =
    previousTemperature + temperatureChange;
B Check Your Work
1 Click New San Diego Zoo to reset that zoo. Do not feed, refill, move or give birth before this test.
2 Confirm the San Diego temperature display reads 77.0.
3 Click the San Diego temperature increase button once. Confirm the display reads 77.5.
4 Click the temperature decrease button once. Confirm the display returns to 77.0.
5 In the source, confirm the calculation starts with this.SanDiegoZoo.BirthArea.Temperature rather than resetting to InitialTemperature on each click.
13.Trace the Temperature Value During Execution
A In MainWindow.xaml.cs, place a breakpoint on the line that calls "ChangeSanDiegoTemperature(this.TemperatureIncrement)" in the increase button event handler
B Place a second breakpoint on the line that starts with "double previousTemperature =" inside ChangeSanDiegoTemperature(double temperatureChange)
C Run the program, create the San Diego Zoo, and click the increase-temperature button
D At the first breakpoint, inspect the argument. At the second breakpoint, inspect the temperatureChange parameter and previousTemperature local variable
E Step over the assignment to this.SanDiegoZoo.BirthArea.Temperature and confirm the field increases by 0.5
Open Each Zoo With the Correct Current Operating State
Acceptance Criteria
  • the established Zoo 1.3 object setup remains in MainWindow;
  • no custom business-class Initialize(...) methods are introduced;
  • Como begins with a birthing-room temperature of 75.0;
  • San Diego begins with a birthing-room temperature of 77.0;
  • both vending machines begin with food stock equal to their configured capacity;
  • AddFoodBag() cannot increase food stock beyond capacity;
  • creating either zoo displays a supplied creation message;
  • established zoo names, people, prices, capacities, animal values, and relationships remain intact.
14.Preserve the Established Zoo 1.3 Setup in MainWindow
A Keep setup in MainWindow
1 Keep CreateComoZoo() and CreateSanDiegoZoo() in MainWindow.xaml.cs
2 Keep the existing object relationships established by the Zoo 1.3 checkpoint
B Confirm the current scenario values
1 Como Zoo
2 Confirm Zoo Capacity: 1000
3 Confirm TicketPrice: 15.00m
4 Confirm Guest: Darla, Age 11, Wallet 5.25m
5 Confirm Vending BagSize: 65.0
6 Confirm FoodCapacity: 250.0
7 Confirm FoodPricePerPound: 0.75m
8 Confirm FeaturedAnimal: Dolly, Age 4, Weight 35.3, Type Dingo
9 San Diego Zoo
10 Confirm Zoo Capacity: 3000
11 Confirm TicketPrice: 25.50m
12 Confirm Guest: Dave, Age 13, Wallet 3.75m
13 Confirm Vending BagSize: 65.0
14 Confirm FoodCapacity: 250.0
15 Confirm FoodPricePerPound: 1.20m
16 Confirm FeaturedAnimal: Patti, Age 5, Weight 3.27, Type Platypus
15.Preserve the Zoo-Specific Birthing-Room Starting Temperatures
A Confirm Como
1 In the creation flow, confirm this.ComoZoo.BirthArea.InitialTemperature is 75.0
2 In the creation flow, confirm this.ComoZoo.BirthArea.Temperature is 75.0
B Confirm San Diego
1 In the creation flow, confirm this.SanDiegoZoo.BirthArea.InitialTemperature is 77.0
2 In the creation flow, confirm this.SanDiegoZoo.BirthArea.Temperature is 77.0
C Confirm the shared room limits
1 Confirm both this.ComoZoo.BirthArea.MaxTemperature and this.SanDiegoZoo.BirthArea.MaxTemperature are 85.0
2 Confirm both this.ComoZoo.BirthArea.MinTemperature and this.SanDiegoZoo.BirthArea.MinTemperature are 55.0
3 Confirm both this.ComoZoo.BirthArea.TemperatureIncrease and this.SanDiegoZoo.BirthArea.TemperatureIncrease are 0.5
16.Begin Each Vending Machine With Available Food Stock
A Set FoodStock from FoodCapacity
1 In MainWindow.xaml.cs, inside CreateComoZoo(), set FoodStock equal to FoodCapacity:
this.ComoZoo.AnimalSnackMachine.FoodStock =
    this.ComoZoo.AnimalSnackMachine.FoodCapacity;
2 In MainWindow.xaml.cs, inside CreateSanDiegoZoo(), set FoodStock equal to FoodCapacity:
this.SanDiegoZoo.AnimalSnackMachine.FoodStock =
    this.SanDiegoZoo.AnimalSnackMachine.FoodCapacity;
B Cap AddFoodBag with Math.Min
1 In VendingMachine.cs, update AddFoodBag() so FoodStock does not increase above FoodCapacity:
this.FoodStock =
    Math.Min(this.FoodStock + this.BagSize, this.FoodCapacity);
C Check Your Work
1 In MainWindow.xaml.cs, set a breakpoint on the closing brace of newComoZooButton_Click by clicking its left margin.
2 Press F5 to start or continue the application. Click New Como Zoo.
3 When Visual Studio pauses, open Debug > Windows > Watch > Watch 1. Enter each full expression below in a separate Watch row.
4 Confirm this.ComoZoo.AnimalSnackMachine.FoodCapacity is 250.0.
5 Confirm this.ComoZoo.AnimalSnackMachine.FoodStock is 250.0.
6 Press F5 to continue. Stop debugging and remove the breakpoint before the next check.
7 In MainWindow.xaml.cs, set a breakpoint on the closing brace of newSanDiegoZooButton_Click by clicking its left margin.
8 Press F5 to start or continue the application. Click New San Diego Zoo.
9 When Visual Studio pauses, open Debug > Windows > Watch > Watch 1. Enter each full expression below in a separate Watch row.
10 Confirm this.SanDiegoZoo.AnimalSnackMachine.FoodCapacity is 250.0.
11 Confirm this.SanDiegoZoo.AnimalSnackMachine.FoodStock is 250.0.
12 Continue, click this zoo’s refill button once and pause in its refill handler after the call. Confirm this.SanDiegoZoo.AnimalSnackMachine.FoodStock remains 250.0.
13 Press F5 to continue. Stop debugging and remove the breakpoint before the next check.
17.Display Which Zoo Was Created Using a Supplied Message
A Add DisplayMessage
1 In MainWindow.xaml.cs, add this method:
public void DisplayMessage(string message)
{
    this.informationTextBox.Text = message;
}
B Display the Como message
1 Inside newComoZooButton_Click, immediately after this.CreateComoZoo();, add this call:
this.DisplayMessage("Created " + this.ComoZoo.Name + ".");
C Display the San Diego message
1 Inside newSanDiegoZooButton_Click, after the zoo is created and the temperature display is refreshed, add this call:
this.DisplayMessage("Created " + this.SanDiegoZoo.Name + ".");
D Check Your Work
1 Start the application and click New Como Zoo. Confirm the information box displays exactly Created Como Zoo..
2 Click New San Diego Zoo. Confirm the same information box now displays exactly Created San Diego Zoo..
Final Check
18.Verify the completed checkpoint
A Use the debugger and the application controls to verify the current checkpoint. A successful build is necessary, but it is not the only evidence that the state is correct
19.Como — Initial State
A Confirm this.ComoZoo.BirthArea.InitialTemperature and this.ComoZoo.BirthArea.Temperature are both 75.0
B Confirm this.ComoZoo.AnimalSnackMachine.FoodCapacity and this.ComoZoo.AnimalSnackMachine.FoodStock are both 250.0
C Confirm Darla Wallet balance is 5.25m
D Confirm Dolly Weight is 35.3
E Confirm Dolly has a non-null Baby with Weight 3.53
F Confirm the information box shows "Created Como Zoo."
20.Como — After the First Current Feed
A Confirm foodWeight = 0.706
B Confirm foodCost = 0.5295m
C Confirm Darla Wallet balance is 4.7205m
D Confirm VendingMachine MoneyBalance is 0.5295m
E Confirm VendingMachine FoodStock is 249.294
F Confirm Dolly Weight is 35.8648
G Confirm Dolly's Baby Weight is 3.6006
21.San Diego — Initial State and Temperature Controls
A Confirm this.SanDiegoZoo.BirthArea.InitialTemperature and this.SanDiegoZoo.BirthArea.Temperature are both 77.0
B Confirm this.SanDiegoZoo.AnimalSnackMachine.FoodCapacity and this.SanDiegoZoo.AnimalSnackMachine.FoodStock are both 250.0
C Confirm Dave Wallet balance is 3.75m
D Confirm Patti Weight is 3.27
E Confirm Patti has a non-null Baby with Weight 0.327
F Confirm the information box shows "Created San Diego Zoo."
G Increase once: 77.0 → 77.5. Decrease once: 77.5 → 77.0
22.San Diego — After the First Current Feed
A Confirm foodWeight = 0.0654
B Confirm foodCost = 0.07848m
C Confirm Dave Wallet balance is 3.67152m
D Confirm VendingMachine MoneyBalance is 0.07848m
E Confirm VendingMachine FoodStock is 249.9346
F Confirm Patti Weight is 3.32232
G Confirm Patti's Baby Weight is approximately 0.33354
23.Finish the final verification
A Save all changed files and build the solution. Resolve compiler errors before submission
B Review the Visual Studio Error List for current errors
C Re-run the key Como and San Diego checks above after the final build
Submit
24.Submit the completed project

Submit the completed Zoo 1.4 project using the course submission process.

A Save all files
B Build the solution
C Review any compiler or course-feedback errors
D Confirm that the submitted project is the Zoo 1.4 copy, not the preserved Zoo 1.3 checkpoint
E Confirm the project still contains the established Zoo structure and the current 1.4 changes
Checkpoint Summary

The final diagram compares the completed Zoo 1.4 structure with the Zoo 1.3 starting point.

Final Zoo 1.4 class diagram compared with the Zoo 1.3 baseline. Green squares mark new members, blue squares mark changed parameterized method signatures, and red squares mark removed members. New items include Animal Baby and percentage fields, Guest money methods, Wallet AddMoney, VendingMachine RemoveFood, and MainWindow temperature/message methods. Changed items include Animal.Eat, Guest.Eat, Wallet.RemoveMoney, and VendingMachine.AddMoney. Removed items include Animal.IsPregnant and VendingMachine.SellFood.
Final structural delta from Zoo 1.3 to Zoo 1.4.
  • New
  • Changed
  • Removed

Zoo 1.4 uses parameters to move the current values into reusable methods, local variables to hold temporary calculations, and simple one-way decisions to protect object state. You also traced the same value across callers and parameters and used one parameterized method to move the San Diego temperature in either direction.