- A temperature-change delegate notifies the console when the birthing room temperature changes.
BirthingRoom, Zoo, and ConsoleHelper classes as specified in the diagram below.public Action<double, double> OnTemperatureChange { get; set; }
BirthingRoom's Temperature setterpreviousTemp before setting the field to the new value.OnTemperatureChange delegate and pass in the previousTemp variable and temperature field.HandleBirthingRoomTemperatureChange method to b168's OnTemperatureChange delegate.This attaches the method to the delegate so that whenever the delegate (property) is called, the method will run.
this.b168.OnTemperatureChange += this.HandleBirthingRoomTemperatureChange;HandleBirthingRoomTemperatureChange method, call the OnBirthingRoomTemperatureChange delegate.Pass the previousTemp and currentTemp parameters through.
ConsoleHelper's HandleBirthingRoomTemperatureChange method, write out the previousTemp and currentTemp to the console.Console.WriteLine($"Previous temperature: {previousTemp:0.0}.");
Console.WriteLine($"New temperature: {currentTemp:0.0}.");AttachDelegates method, plug in the HandleBirthingRoomTemperatureChange method to the zoo's OnBirthingRoomTemperatureChange delegate.SetTemperature method now only needs to set the birthing room temperature and catch any exceptions that might occur.Remove any code that writes temperatures to the console. Replace the code in the try block with the code below.
zoo.BirthingRoomTemperature = double.Parse(temperature);Program.cs, call the AttachDelegates method afterAttachDelegates in the Program.cs.AttachDelegates.Handle method into the OnChange method.The OnBirthingRoomTemperature change delegate (property) now is the HandleBirthingRoomTemperatureChange method in the ConsoleHelper class.

SetTemperature method in the ConsoleHelper class on the line that sets the BirthingRoomTemperature.'temp 60'OnTemperatureChange delegate in the Temperature property.Ensure that the OnTemperatureChange delegate has the method HandleBirthingRoomTemperatureChange plugged into it.
OnTemperatureChange getter and then into the HandleBirthingRoomTemperatureChange method in the Zoo class.Ensure the OnBirthingRoomTemperatureChange delegate has the
HandleBirthingRoomTemperatureChange method plugged into it.
OnBirthingRoomTemperatureChange getter and then into the HandleBirthingRoomTemperatureChange method in the ConsoleHelper class.MainWindow.xaml.cs as specified in the diagram below.
ConfigureBirthingRoomControls method into the HandleBirthingRoomTemperatureChange and remove the ConfigureBirthingRoomControls method and all references to it.HandleBirthingRoomTemperatureChangeChange method, change any references to BirthingRoom.Temperature to the currentTemp parameter.AttachDelegates method, plug in the HandleBirthingRoomTemperatureChange method to the zoo's OnBirthingRoomTemperatureChange delegate.AttachDelegates method after creating a zoo in window_Loaded, restarting the zoo in restartButton_Click, and loading the zoo in the LoadZoo.The label, border height, and border background color all should change as the temperature changes.
OnBirthingRoomTemperatureChange auto-property to be a full property with a backing private field.Mark the private field as NonSerialized.
save button.load button and load your previous save.OnDeserialized method to the Zoo class as specified in the diagram below.
OnDeserialized method.OnBirthingRoomTemperatureChange delegate.Pass in the birthing room's current temperature for both parameters.
OnDeserialized method at the end of the MainWindow's AttachDelegates method.Then close the application. It should close successfully.
The auto-saved zoo should be loaded. The label and border should be updated automatically now to the previously save temperature.
Console ApplicationBirthingRoom's Temperature automatically writes the old and new temperatures to the consoleBirthingRoom's Temperature setter on the line that calls its OnTemperatureChange delegateZoo's HandleBirthingRoomTemperatureChange on the line that calls the Zoo's OnBirthingRoomTemperatureChange delegateConsoleHelper's HandleBirthingRoomTemperatureChange methodConsole Application and enter the command "temp 60"MainWindow's HandleBirthingRoomTemperatureChange method© 2026 Northcentral Technical College