Zoo 1.2 shifts from working mainly with individual objects to defining the class blueprints those objects use. You will add BirthingRoom and VendingMachine, create Como Zoo objects from those definitions, and reuse the same class design for a separate San Diego Zoo.
A class defines a reusable kind of object. Multiple objects can be created from the same class, and each object can maintain its own state.
Make a copy of your code at the beginning of each week and rename the folder and ..sln file to the appropriate week number. Doing so will help you maintain a record of your work and keep a working copy of your code in case you need to revert your changes.
This class structure already exists. Zoo 1.2 extends it.
BirthingRoom and VendingMachine use only the current Zoo 1.2 fields.Zoo contains BirthArea : BirthingRoom and AnimalSnackMachine : VendingMachine.BirthArea.Doctor refers to Flora, number 98.MainWindow contains SanDiegoZoo : Zoo.Define BirthingRoom and add only the current Zoo 1.2 fields and class relationships required by the scenario.
Before you write the new class, use Solution Explorer to add the class file to the ZooScenario project.

Now continue with the class structure for BirthingRoom.
Insert the following suppression pattern. Keep the two attributes together in one horizontally scrollable code frame and keep each attribute on one physical source line:
C#
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Event handlers may begin with lower-case letters.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Encapsulation not yet taught.")]BirthingRoom exists, but it does not yet describe the temperature information the current scenario needs.
Add the five current scalar fields shown in the class diagram.
These values belong to one birthing-room object's state. double supports the current fractional values such as 77.0 and 0.5.
A birthing-room object must be able to refer to an animal when the scenario requires one.
Add the current Animal-typed field represented as a class relationship.
Animal is the class/type and also the field/role name. The class relationship describes what a BirthingRoom can reference; it does not create an Animal object.
Animal class and exact current field nameThe room also needs a reference to the employee serving as the doctor.
Add the current Employee-typed Doctor field.
Doctor class was introducedConnect Zoo to BirthingRoom, then create and configure the Como BirthArea.
Declaring BirthArea creates the class relationship. It does not create the runtime BirthingRoom object.
This focused source line adds separate meaning because it shows that the current temperature is initialized from the initial temperature:
C#
this.ComoZoo.BirthArea.Temperature = this.ComoZoo.BirthArea.InitialTemperature;ComoZoo.BirthAreaBirthArea.Doctor refers to an EmployeeDefine VendingMachine with the current five fields and connect it to Zoo.
BagSize, FoodCapacity, and FoodStock use double. FoodPricePerPound and MoneyBalance use decimal.
VendingMachine contains the five current fields and no methodsBirthArea remains intactCreate the Como AnimalSnackMachine and configure the authoritative current state.
ComoZoo.AnimalSnackMachineBagSize = 65.0, FoodCapacity = 250.0, and FoodPricePerPound = 0.75Use the existing Zoo, Animal, Employee, Restroom, Booth, BirthingRoom, and VendingMachine classes to create a separate San Diego object graph.
The UI markup is not represented by the UML, so use the exact current button source:
XML
<Button x:Name="newSanDiegoZooButton" Content="New San Diego Zoo" Click="newSanDiegoZooButton_Click"/>
New San Diego ZooDiego Zoo button is present in the supplied UI pathThe current one-line handler signature is:
C#
private void newSanDiegoZooButton_Click(object sender, RoutedEventArgs e)The event path coordinates creation of a separate object graph. Do not copy a complete finished handler body from this walkthrough.
Create the separate San Diego objects using the same class definitions and the current source values.
ComoZoo and SanDiegoZoo are different Zoo objects that use the same class. Their supporting objects hold separate state, so a second zoo does not require duplicate domain classes.
ComoZoo and SanDiegoZooZoo objectsBirthingRoom has InitialTemperature, MaxTemperature, MinTemperature, TemperatureIncrease, Animal, Doctor, and Temperature with the current types.VendingMachine has BagSize, FoodCapacity, FoodPricePerPound, FoodStock, and MoneyBalance with the current types.Zoo includes BirthArea : BirthingRoom and AnimalSnackMachine : VendingMachine.MainWindow includes SanDiegoZoo : Zoo.BirthArea has 77.0 / 85.0 / 55.0 / 0.5 / 77.0.BirthArea.Doctor is Flora #98.AnimalSnackMachine has 65.0 / 250.0 / 0.75.San Diego ZooZoo; Capacity = 3000.25.50; attendant = Betty #84.12 with the supplied Female/Male values.Use the normal build/error-reading and already-taught inspection paths. This page does not claim your project built or ran successfully; verify that in your own project.
Open the Feedback System to continue with the current submission/readiness process.