Answered step by step
Verified Expert Solution
Link Copied!

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:
1. The properties are self-explanatory. The getter is public and the setter is mostly absent.
Constructor:
1. public Pet(string 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:
1. 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 Week02_Lab05
Winter 2024 Page 2 of 2
2. public void SetOwner(string owner) This method simply assigns the argument
to the appropriate field.
3. public void Train() This method sets the property IsHouseTrained to true.
Test Harness
In your main method write the code to do the following:
1. Create four objects. You decide on the arguments
2. Create a List to store all the above objects.
3. Use some of the methods on some of the objects.
4. Using a suitable looping statement, display all the objects in the collection.
5. Prompt the user fo

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions

Question

=+Where does the focus of labor relations lie? Is it collective

Answered: 1 week ago