Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description of members: Fields: There are no fields. Properties: 1 . The properties are self - explanatory. The getter is public and the setter is
Description of members:
Fields:
There are no fields.
Properties:
The properties are selfexplanatory. The getter is public and the setter is mostly absent
Constructor:
public Petstring name, int age, string description This constructor
takes three arguments and assigns them to the appropriate properties. It also initializes
the fields owner to no one and isHousedTrained to false
Methods:
public override string ToString This method
returns a string fully describing this object.
Remember the ToString
method is needed to produce a
sensible output on the screen
Programming II Pet: properties, list WeekLab
Winter Page of
public void SetOwnerstring owner This method simply assigns the argument
to the appropriate field.
public void Train This method sets the property IsHouseTrained to true.
Test Harness
In your main method write the code to do the following:
Create four objects. You decide on the arguments
Create a List to store all the above objects.
Use some of the methods on some of the objects.
Using a suitable looping statement, display all the objects in the collection.
Prompt the user fo
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started