Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.Write class that extends the LeggedMammal class from the previous laboratory exercise. The class will represent a Dog. Consider the breed, size and is registered.

1.Write class that extends the LeggedMammal class from the previous laboratory exercise. The class will represent a Dog. Consider the breed, size and is registered. Initialize all properties of the parent class in the new constructor. This time, promote the use of accessors and mutators for the new properties.Instantiate a Dog object in the main function and be able to set the values of the properties of the Dog object using the mutators.Display all the properties of the Dog object using the accessors.

2.Write class that extends the Person class from the previous laboratory exercise. The class will represent a Student. Consider the academic program, year in college and enrolled university. Initialize all the properties of the parent class in the new constructor. This time, promote the use of accessors and mutators for the new properties.Instantiate a Student object in the main function and be able to set the values of the properties of the Student object using the mutators.Display all the properties of the Student object using the accessors.

I got the class I made from the previous exercises. Here's the vscodes:

For previous laboratory excercise 1(LeggedMammal):

#include

#include

usingnamespacestd;

classMammal

{

private:

shortmlegs;

stringmfur;

boolmtail;

public:

Mammal(shortlegs,stringfur,booltail)

{

mlegs=legs;

mfur=fur;

mtail=tail;

}

stringgetMammal()

{

ostringstreams;

s<<"NumberofLegs:"<

s<<"KindofFur:"<

s<<"PresenceofTail:"<

returns.str();

}

};

For previous laboratory excercise 2(Person):

#include

#include

usingnamespacestd;

classPerson

{

private:

stringName,Address,Gender,Occupation;

intAge;

public:

Person(stringname,stringaddress,stringgender,intage,stringoccupation)

{

Name=name;

Address=address;

Gender=gender;

Age=age;

Occupation=occupation;

}

stringgetPerson()

{

ostringstreams;

s<<"Name:"<

s<<"Address:"<

s<<"Gender:"<

s<<"Age:"<

s<<"Occupation:"<

returns.str();

}

};

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

The use of research in integrated marketing communications

Answered: 1 week ago