Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Completion Fill in the blanks from the implementation of a Dog class: class Dog

ID: 3934573 • Letter: C

Question

Completion

Fill in the blanks from the implementation of a Dog class:

class Dog {

________________________________

void setName( string name );

void setOwner( string owner );

void setIsFriendly( bool isFriendly );

string getName() const;

string getOwner() const;

bool getIsFriendly() const;

________________________________

string m_name; // dog's name

string m_owner; // owner's name

_______________m_isFriendly; // true if friendly

};

In my main function, I create a Dog object named jessie and use the "set"

methods to initialize jessie's variables. Complete the following code to print

jessie's name and, if she is friendly, print the message "You can pet me!":

cout << _____________________________ << endl;

if ( ______________________________ )

cout << "You can pet me!" << endl;

Explanation / Answer

_______________m_isFriendly; // true if friendly

Since the above variable holds true and false that should be bool.

So answer is

bool m_isFriendly;

cout << _____________________________ << endl;

There is one method getName() which can return pet name so the answer is

jessie.getName()

if(jessie.getIsFriendly() == true)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote