Question: 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
Get step-by-step solutions from verified subject matter experts
