2.7 Zoo Learning Activity [3 hours 15 minutes]

Properties
1.Getting Started [5 minutes]

Continue from your completed Zoo 2.6. Use the diagrams and the directions below to make the next set of changes.

A Copy your Zoo 2.6 ending code, renaming both the folder and the Visual Studio solution file for Zoo 2.7 using your last name. Open the copied solution and restore its NuGet packages.
B In MainWindow.xaml, set the window attribute to Title="Programming Concepts 2: Zoo 2.7 Lastname" , using your last name. Keep the project target at .NET Framework 4.8.
Combined starting structure — Zoo 2.6
Starting structure — combined Zoo 2.6 classes
C Check Your Work
1 Build the copied solution. Create both zoos and confirm counts, feeding, birth-space protection, direction controls and temperature buttons work.
Expose object information through properties
Acceptance Criteria
  • Getters return information from private fields.
  • Only the properties that need outside assignment have setters.
2.Make the remaining Animal fields private [5 minutes]
Problem

The Animal class still has public fields that can be altered from outside the class.

Solution

You will change their visibility and add properties for the information other classes need.

AnimalProperties — exact Zoo 2.7 declarations
Animal backing fields, properties and feeding helpers
A Modify Animal.cs.
1 Make HappinessLevel, Name, Type and Weight private backing fields named happinessLevel, name, type and weight. Keep the existing private age, sex and baby fields. This task changes the fields; the following tasks add the properties shown in the focused diagram.
2 Update the constructor and the class’s own field reads/writes to use the backing fields. Keep baby.Weight as a read where only the returned value is needed.
3 In Eat, update the unborn baby’s weight through this.baby.weight. Code inside Animal can access a private field on another Animal object.
B Check Your Work
1 Trace the fields changed by Eat, Move and Reproduce. An animal’s own state changes still happen inside Animal; its public properties will provide the reads.
3.Define Animal.Name with a getter and setter [5 minutes]
A Use the illustrated Name property pattern.
1 The getter returns this.name. The setter assigns this.name = value;.
Animal Name property
public string Name
{
    get
    {
        return this.name;
    }

    set
    {
        this.name = value;
    }
}
Reading Animal.Name returns the private name.
Reading Animal.Name returns the private name.
Assigning Animal.Name stores the supplied value.
Assigning Animal.Name stores the supplied value.
B Check Your Work
1 Trace baby.Name = "Baby";: the setter receives "Baby" as value and stores it in the baby’s private name field.
4.Define the read-only Animal information properties [5 minutes]
A Use the focused class diagram and the Name getter as a pattern.
1 Define each getter in the table using its shown return type and return expression. Keep these properties getter-only.
2 Replace GetSex() with Sex; remove the old GetSex method after moving its return statement into the getter.
Animal read-only properties
Property Type Getter returns
HappinessLevel int this.happinessLevel
Sex string this.sex
Type string this.type
Weight double this.weight
B Check Your Work
1 As a source trace, a read of animal.Weight returns its stored value. An outside assignment to Weight will no longer be valid, so internal changes must use the backing field.
5.Replace Animal.GetIsPregnant() with IsPregnant [5 minutes]
PregnancyPropertySignature — exact Zoo 2.7 declarations
IsPregnant property signature
A Move the existing method body into a getter.
1 Define IsPregnant as a public getter-only property of type bool. Return this.baby != null.
2 Remove GetIsPregnant and update each call to use IsPregnant without parentheses.
IsPregnant computes its result when read.
IsPregnant computes its result when read.
B Check Your Work
1 Compare the getter with the previous method. The expression and returned meaning remain the same.
6.Replace Animal.GetPortionSize() with PortionSize [5 minutes]
PortionPropertySignature — exact Zoo 2.7 declarations
PortionSize property signature
A Move the existing method body into a getter.
1 Define PortionSize as a public getter-only property of type double. Return this.weight * this.portionSizePercentage.
2 Remove GetPortionSize and update each call to use PortionSize without parentheses.
PortionSize computes its result when read.
PortionSize computes its result when read.
B Check Your Work
1 Compare the getter with the previous method. The expression and returned meaning remain the same.
Read transaction information through getters
Acceptance Criteria
  • Food weight, balances, machine price and stock can be read through properties.
  • Existing transaction methods continue to change balances and stock.
7.Modify the Booth attendant access [5 minutes]
BoothAttendantSignature — exact Zoo 2.7 declarations
Booth fields and property signatures
A Modify Booth.cs.
1 Make Attendant private as attendant and update the constructor assignment.
2 Define the getter-only properties in the table. Update the affected reads in other classes to use the property name without parentheses.
Booth getters
Property Type Getter returns
Attendant Employee this.attendant
B Check Your Work
1 Trace a getter read against the field or expression in the table. No transaction is performed just by reading it.
8.Modify the Food weight access [5 minutes]
FoodWeightSignature — exact Zoo 2.7 declarations
Food fields and property signatures
A Modify Food.cs.
1 Make Weight private as weight and have Food(double weight) assign this.weight = weight;.
2 Define the getter-only properties in the table. Update the affected reads in other classes to use the property name without parentheses.
Food getters
Property Type Getter returns
Weight double this.weight
Food.Weight reads the weight supplied during construction.
Food.Weight reads the weight supplied during construction.
B Check Your Work
1 Trace a getter read against the field or expression in the table. No transaction is performed just by reading it.
9.Replace Wallet.GetMoneyBalance() with a property [5 minutes]
WalletBalanceSignature — exact Zoo 2.7 declarations
Wallet fields and property signatures
A Modify Wallet.cs.
1 Keep the private moneyBalance field. Move the existing getter method’s return into the property, then remove the method.
2 Define the getter-only properties in the table. Update the affected reads in other classes to use the property name without parentheses.
Wallet getters
Property Type Getter returns
MoneyBalance decimal this.moneyBalance
Wallet.MoneyBalance reads the current balance.
Wallet.MoneyBalance reads the current balance.
B Check Your Work
1 Trace a getter read against the field or expression in the table. No transaction is performed just by reading it.
10.Replace Guest.GetMoneyBalance() with a property [5 minutes]
GuestBalanceSignature — exact Zoo 2.7 declarations
Guest fields and property signatures
A Modify Guest.cs.
1 Keep the private wallet field. Move the method’s return into the property, reading wallet.MoneyBalance, then remove the method.
2 Define the getter-only properties in the table. Update the affected reads in other classes to use the property name without parentheses.
Guest getters
Property Type Getter returns
MoneyBalance decimal this.wallet.MoneyBalance
Guest.MoneyBalance forwards the wallet property read.
Guest.MoneyBalance forwards the wallet property read.
B Check Your Work
1 Trace a getter read against the field or expression in the table. No transaction is performed just by reading it.
11.Replace the machine read methods with properties [5 minutes]
MachinePropertiesSignature — exact Zoo 2.7 declarations
VendingMachine fields and property signatures
A Modify VendingMachine.cs.
1 Keep the existing private fields. Replace GetFoodPricePerPound and GetFoodStock with the corresponding getter-only properties.
2 Define the getter-only properties in the table. Update the affected reads in other classes to use the property name without parentheses.
VendingMachine getters
Property Type Getter returns
FoodPricePerPound decimal this.foodPricePerPound
FoodStock double this.foodStock
B Check Your Work
1 Trace a getter read against the field or expression in the table. No transaction is performed just by reading it.
12.Update Guest.FeedAnimal(...) [5 minutes]
A Replace the old read-method calls in the existing transaction.
1 Use animal.PortionSize, machine.FoodPricePerPound, machine.FoodStock and this.wallet.MoneyBalance in the corresponding existing expressions.
2 Keep the rest of the price, funds, stock, payment, refund and result-code paths.
Guest feeding read replacements
Previous read Property read
animal.GetPortionSize() animal.PortionSize
machine.GetFoodPricePerPound() machine.FoodPricePerPound
machine.GetFoodStock() machine.FoodStock
this.wallet.GetMoneyBalance() this.wallet.MoneyBalance
The existing feeding flow reads properties instead of getter methods.
The existing feeding flow reads properties instead of getter methods.
B Check Your Work
1 Trace the actual this.wallet.MoneyBalance read during Guest.FeedAnimal. Trace the separate Guest.MoneyBalance forwarding getter from its source.
Expose current population information
Acceptance Criteria
  • AnimalCount is the population count; CountAnimals remains the display-area count.
  • TotalAnimalWeight and AverageAnimalWeight calculate their values from current animals.
13.Make Zoo’s object references private and add properties [5 minutes]
ZooAccessProperties — exact Zoo 2.7 declarations
Zoo exposes controlled access to its connected objects
A Modify Zoo.cs and its constructor.
1 Make AnimalSnackMachine, BirthArea, Pen, Tank, TicketBooth and Visitor private backing fields with lowercase names. Keep the existing private name field.
2 In the constructor and Zoo’s own behavior methods, use the private fields where the object owns the assignment or action.
3 Add getter-only properties for AnimalSnackMachine, BirthArea, TicketBooth and Visitor. Replace GetName() with the getter-only Name property.
4 Add Pen and Tank properties with both get and set accessors. MainWindow’s existing area creation still assigns these two references.
Zoo access properties
Property Type Getter returns Setter
AnimalSnackMachine VendingMachine this.animalSnackMachine None
BirthArea BirthingRoom this.birthArea None
Name string this.name None
TicketBooth Booth this.ticketBooth None
Visitor Guest this.visitor None
Pen Pen this.pen this.pen = value
Tank Tank this.tank this.tank = value
B Check Your Work
1 Trace each constructor assignment to its backing field. MainWindow still reads the public property names; its Pen and Tank assignments use setters.
14.Replace Zoo.GetAnimalCount() with AnimalCount [5 minutes]
CountPropertySignature — exact Zoo 2.7 declarations
AnimalCount is a getter-only property
A Move the existing method body into the property getter.
1 Keep the existing visibility, return type, local variables and body. Remove the old method after its body has been moved. In particular, TotalAnimalWeight stays private because only Zoo uses it.
Population count property
public int AnimalCount
{
    get
    {
        return this.animals.Count;
    }
}
AnimalCount returns current population information.
AnimalCount returns current population information.
B Check Your Work
1 Trace the getter with the starting Como population. Its result matches the previous method’s result.
15.Replace Zoo.CalculateTotalAnimalWeight() with TotalAnimalWeight [5 minutes]
TotalPropertySignature — exact Zoo 2.7 declarations
TotalAnimalWeight is a getter-only property
A Move the existing method body into the property getter.
1 Keep the existing visibility, return type, local variables and body. Remove the old method after its body has been moved. In particular, TotalAnimalWeight stays private because only Zoo uses it.
TotalAnimalWeight returns current population information.
TotalAnimalWeight returns current population information.
B Check Your Work
1 Trace the getter with the starting Como population. Its result matches the previous method’s result.
16.Replace Zoo.CalculateAverageAnimalWeight() with AverageAnimalWeight [5 minutes]
AveragePropertySignature — exact Zoo 2.7 declarations
AverageAnimalWeight is a getter-only property
A Move the existing method body into the property getter.
1 Keep the existing visibility, return type, local variables and body. Remove the old method after its body has been moved. In particular, TotalAnimalWeight stays private because only Zoo uses it.
2 In the average getter, replace CalculateTotalAnimalWeight() with this.TotalAnimalWeight. Keep the existing this.animals.Count reads.
AverageAnimalWeight returns current population information.
AverageAnimalWeight returns current population information.
B Check Your Work
1 Trace the getter with the starting Como population. Its result matches the previous method’s result.
Keep the room temperature in range
Acceptance Criteria
  • Temperature has a getter and a range-checked setter.
  • Both birth-related and button-related increments use the property.
17.Make BirthingRoom references and limits private [5 minutes]
RoomProperties — exact Zoo 2.7 declarations
BirthingRoom fields and properties
A Modify BirthingRoom.cs.
1 Make Doctor private as doctor. Update the constructor with this.doctor = doctor;. No stored Mother member is needed; BirthAnimal already receives its mother parameter.
2 Keep the existing private readonly limits unchanged: maxTemperature is 85.0 and minTemperature is 55.0.
3 Add getter-only Doctor, MaxTemperature and MinTemperature properties returning their corresponding private fields.
Room accessors
Property Getter returns Setter
Doctor this.doctor None
MaxTemperature this.maxTemperature None
MinTemperature this.minTemperature None
B Check Your Work
1 The allowed limits now belong to the room. Its current temperature will be read and checked by the next property.
18.Use a property to control the temperature of the birthing room [5 minutes]
Problem

The existing private helper already enforces 55–85. Move that validation into the Temperature setter so property assignments enforce the same rule.

Solution

You will define a property with logic inside it to control the temperature range.

A Replace GetTemperature() with a Temperature property.
1 The getter returns this.temperature. In the setter, perform this.temperature = value; only when value is between minTemperature and maxTemperature, inclusive.
2 Remove GetTemperature after moving its read operation into the getter. Keep invalid assignments from changing the stored temperature.
Temperature property
public double Temperature
{
    get
    {
        return this.temperature;
    }

    set
    {
        if (value >= this.minTemperature && value <= this.maxTemperature)
        {
            this.temperature = value;
        }
    }
}
The Temperature getter reads the stored value.
The Temperature getter reads the stored value.
The Temperature setter accepts values from 55 through 85 inclusive.
The Temperature setter accepts values from 55 through 85 inclusive.
B Check Your Work
1 Trace values 55.0 and 85.0 as accepted. Trace 54.5 and 85.5 as rejected; the existing stored temperature is retained.
19.Update BirthingRoom.BirthAnimal(...) [5 minutes]
A Route birth-related changes through the property.
1 Use mother.IsPregnant and the private doctor reference in the existing condition.
2 Keep this.IncreaseTemperature() before calling this.doctor.DeliverAnimal(mother). The existing public action delegates to ChangeTemperature, whose updated body uses the property. Keep the existing returned-baby behavior.
BirthAnimal uses the validated property for its increment.
BirthAnimal uses the validated property for its increment.
B Check Your Work
1 At a current temperature of 85.0, a proposed birth increment of 0.5 is rejected by the setter. The existing delivery call still follows the property operation.
20.Update BirthingRoom.ChangeTemperature(...) [5 minutes]
A Use the property for button-related changes.
1 Keep ChangeTemperature private and change its body to this.Temperature += temperatureChange;. Keep IncreaseTemperature and DecreaseTemperature as the public fixed-step actions.
ChangeTemperature reads then assigns Temperature.
ChangeTemperature reads then assigns Temperature.
The + handler calls IncreaseTemperature, which delegates through the private helper to the bounded Temperature property.
A temperature button reads the old value, checks the proposed value in the setter, then reads the display value.
B Check Your Work
1 Trace the getter and setter separately: the getter supplies the old value; the setter checks the proposed new value.
21.Replace Zoo.GetTemperatureDisplay() with TemperatureDisplay [5 minutes]
A Move the existing formatting into a getter.
1 Return this.birthArea.Temperature.ToString("0.0") from a getter-only string property, then remove GetTemperatureDisplay.
TemperatureDisplay formats the current room property.
TemperatureDisplay formats the current room property.
B Check Your Work
1 The formatted result still has one digit after the decimal point.
22.Replace Pen.GetDisplayLocation() with DisplayLocation [5 minutes]
PenDisplaySignature — exact Zoo 2.7 declarations
Pen.DisplayLocation property signature
A Move the complete existing map body into a getter.
1 Keep the local display variable, loops, X/x/empty markers, separators and return statement. Remove only the old method wrapper and replace it with the public string property and get accessor.
B Check Your Work
1 Compare the getter body with the previous method. Array indexes, occupied-cell behavior and generated map text stay the same.
23.Replace Tank.GetDisplayLocation() with DisplayLocation [5 minutes]
TankDisplaySignature — exact Zoo 2.7 declarations
Tank.DisplayLocation property signature
A Move the complete existing map body into a getter.
1 Keep the local display variable, loops, X/x/empty markers, separators and return statement. Remove only the old method wrapper and replace it with the public string property and get accessor.
B Check Your Work
1 Compare the getter body with the previous method. Array indexes, occupied-cell behavior and generated map text stay the same.
24.Update MainWindow.DisplayAnimalArea(...) [5 minutes]
A Read the map properties instead of calling methods.
1 Use zoo.Pen.DisplayLocation for the Como pen and zoo.Tank.DisplayLocation for the San Diego tank. Keep the existing zoo guards and TextBox names.
DisplayAnimalArea reads the existing maps through properties.
DisplayAnimalArea reads the existing maps through properties.
B Check Your Work
1 No map-building logic belongs in MainWindow; each property returns the map its class already built.
Use properties and inline creation in the window
Acceptance Criteria
  • The same scenario values and object relationships are preserved.
  • Both zoo paths read their new public property names.
25.Update MainWindow.CreateComoZoo() [10 minutes]
A Use the inline-construction activity diagram to create the attendant directly as Booth’s constructor argument. Preserve the remaining setup, exact scenario values, pregnancy and registration calls, pen/tank references and area refresh.
Create the booth attendant inline without duplicating the Employee.
CreateComoZoo creates one attendant inline and preserves the existing scenario.
26.Update MainWindow.CreateSanDiegoZoo() [10 minutes]
A Use the inline-construction activity diagram to create the attendant directly as Booth’s constructor argument. Preserve the remaining setup, exact scenario values, pregnancy and registration calls, pen/tank references and area refresh.
Create the booth attendant inline without duplicating the Employee.
CreateSanDiegoZoo creates one attendant inline and preserves the existing scenario.
27.Update MainWindow.FeedAnimal(...) [5 minutes]
A Use the Zoo.Name property in the existing success message.
1 Replace zoo.GetName() with zoo.Name. Keep the animal search, Guest.FeedAnimal call, switch and messages.
B Check Your Work
1 This is a read of Zoo.Name, a different class’s property from Animal.Name.
28.Update the existing event-handler reads [5 minutes]
A Replace the old getter calls with their properties, preserving each handler’s other behavior.
1 Apply the replacements in this table to the indicated handlers.
2 Update the count and average result assignments to use AnimalCount and AverageAnimalWeight. Keep the existing private result fields and messages.
Window property replacements
Where Previous expression Replacement
newComoZooButton_Click this.comoZoo.GetName() this.comoZoo.Name
newSanDiegoZooButton_Click this.sanDiegoZoo.GetName() this.sanDiegoZoo.Name
Both birth handlers baby.GetSex() baby.Sex
birthPlatypusButton_Click this.sanDiegoZoo.GetTemperatureDisplay() this.sanDiegoZoo.TemperatureDisplay
Increase/decrease and new San Diego handlers this.sanDiegoZoo.BirthArea.GetTemperature() this.sanDiegoZoo.BirthArea.Temperature
getComoZooAnimalCount_Click this.comoZoo.GetAnimalCount() this.comoZoo.AnimalCount
getSanDiegoZooAnimalCount_Click this.sanDiegoZoo.GetAnimalCount() this.sanDiegoZoo.AnimalCount
getComoZooAverageAnimalWeight_Click this.comoZoo.CalculateAverageAnimalWeight() this.comoZoo.AverageAnimalWeight
getSanDiegoZooAverageAnimalWeight_Click this.sanDiegoZoo.CalculateAverageAnimalWeight() this.sanDiegoZoo.AverageAnimalWeight
Give animal types their feeding response
Acceptance Criteria
  • The shared weight updates remain in Eat.
  • Private helpers change the animal’s happiness for the two supported responses.
29.Define the private Animal.Bark() helper [5 minutes]
A Use the focused signature and activity diagram.
1 Define private void Bark() and increase happiness with this.happinessLevel += 2;.
Bark increases the dingo happiness level by two.
Bark increases the dingo happiness level by two.
B Check Your Work
1 Trace happinessLevel changing from 0 to 2. Eat calls this helper for type "Dingo".
30.Define the private Animal.StashInPouch(Food food) helper [5 minutes]
A Use the existing Food reference parameter.
1 Define private void StashInPouch(Food food). Increase happiness with this.happinessLevel++;.
StashInPouch increases the platypus happiness level by one.
StashInPouch increases the platypus happiness level by one.
B Check Your Work
1 Trace a happinessLevel of 0 becoming 1. The current helper does not alter the food object.
31.Make the feeding decision in Animal.Eat more readable [5 minutes]
Problem

A feeding action should use the shared weight changes and then choose the response for its type.

Solution

You will use the switch statement pattern from the diagrams and call the private helpers.

A Keep the common weight updates and add the type switch.
1 Use food.Weight and the private percentage fields for the existing weight updates. Change this animal’s backing field this.weight and, when pregnant, this.baby.weight.
2 Switch on this.type. Call Bark for "Dingo", StashInPouch(food) for "Platypus", and leave the default case with no additional state change. Keep break statements.
Eat updates weights and chooses its type-specific response.
Eat updates weights and chooses its type-specific response.
B Check Your Work
1 Trace each switch case. Every supported animal still receives the common weight update before its extra response.
32.Build and check the property conversion [5 minutes]
A Check Your Work
1 Build after all fields, properties, callers and helpers are complete. Remove the public-field suppression only from classes whose fields are now all private. Pen and Tank still have public fields.
2 Create both zoos and confirm populations 3 and 2 and initial averages approximately 28.2 and 1.885. Use directions and confirm X/x map behavior remains.
3 Set a breakpoint on Bark’s increment before feeding. Recreate Como and feed Dolly once. When paused, add this.happinessLevel to Watch, then step over the increment and observe 2. Set a breakpoint on StashInPouch’s increment before feeding. Recreate San Diego and feed Patti once; when paused, add this.happinessLevel to Watch, then step over it and observe 1. Press F5 after each observation and remove the breakpoints.
33.Follow the Animal.Name setter during birth [5 minutes]
A Remove earlier breakpoints and create a fresh Como Zoo. Set a breakpoint on this.name = value; in Animal.Name, then click Give birth to dingo.
Watch inside the Animal.Name setter
Expression Before the assignment
this.name Empty string; the baby constructor used string.Empty
value "Baby"
this.Type "Dingo"
this The newborn Animal, not MainWindow or the mother
B Use F10 to follow the assignment.
1 After the assignment, this.name is "Baby". The public Name getter now reads that same value.
2 Press F5 to finish the birth handler, confirm the newborn map marker, then click Get animal count in the Como column to confirm population count 4. Remove the setter breakpoint.
C Check Your Work
1 The list and array contain the same newborn whose name was assigned through the setter.
34.Step through the Temperature getter and setter [5 minutes]
A Stop debugging and disable earlier breakpoints. Set only a caller breakpoint on this.sanDiegoZoo.BirthArea.IncreaseTemperature() in increaseSanDiegoTemperatureButton_Click. Start, create San Diego, then click +. The caller breakpoint pauses before the action. While paused there, set or enable breakpoints on return this.temperature; in the Temperature getter and on the condition inside its setter. Enabling these after creation avoids pausing during the initial display refresh. Add this.sanDiegoZoo.BirthArea.temperature to Watch: 77.0. this is MainWindow here; value is unavailable.
B Use F11 through IncreaseTemperature and the private ChangeTemperature helper. At the getter breakpoint, this is BirthingRoom. Add this.temperature, this.minTemperature, this.maxTemperature and value to Watch before continuing. The first three are 77.0, 55.0 and 85.0; value is unavailable in get. Continue to the setter breakpoint: value is now 77.5. Follow the condition and assignment; inspect this.temperature after the assignment executes. It becomes 77.5. Disable the breakpoints and press F5; the display becomes 77.5.
C Explain why += invokes get before set. A rejected set leaves the stored field unchanged. If stepping skips properties, use the explicit getter/setter breakpoints above; the relevant bodies still pause there.
35.Check accepted and rejected temperature changes [5 minutes]
A Source trace: the setter accepts 55.0 and 85.0 and rejects 54.5 and 85.5, retaining the previous value.
B Remove property breakpoints and resume before clicking controls. Reset San Diego: the display is 77.0. Click + sixteen times: 85.0. One more + keeps 85.0. Click - sixty times: 55.0. One more - keeps 55.0. Click + once: 55.5. Reset again and verify + then - produces 77.5 then 77.0. No temporary source edits or Watch assignments are required.
36.Follow calculated property getters [5 minutes]
A Remove earlier breakpoints and recreate San Diego. Before clicking, set breakpoints on the result assignment in getSanDiegoZooAverageAnimalWeight_Click and the first statements inside the AverageAnimalWeight and TotalAnimalWeight getters. Then click Get average animal weight.
Watch at the average handler
Expression Expected state
this.zooAverageAnimalWeight Last stored result; assignment has not run
averageWeight Unavailable in MainWindow; belongs to the average getter
totalWeight Unavailable in MainWindow; belongs to the total getter
this.sanDiegoZoo.animals Private list; this.sanDiegoZoo.animals.Count is 2
B Follow the actual getters with F11, F10 and their breakpoints.
1 After the local declaration in AverageAnimalWeight, averageWeight is 0. The guard reads this.animals.Count as 2.
2 Follow TotalAnimalWeight: totalWeight becomes approximately 3.27 and then 3.77. Return to the average getter and observe approximately 1.885 after division.
3 Return to the event handler. Its result field receives the value after the assignment executes. Remove the breakpoints and press F5 to display the result.
C Check Your Work
1 The average getter reads TotalAnimalWeight and the list’s Count. It does not need to call the old calculation methods.
Complete the assignment
37.Review the ending structure [5 minutes]
A Use the ending diagrams to explain how the objects now control or expose their state.
Combined ending structure — Zoo 2.7
Ending structure — combined Zoo 2.7 classes
38.Submit a zipped Visual Studio solution [5 minutes]
A Save and build your .NET Framework 4.8 solution. Zip the solution and submit it to the Feedback System. Submit the Feedback System URL to the correct assignment in Canvas.