1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleonysh [2.5K]
3 years ago
13

Write a class "Dog" with a private int field called months and two public member functions setAge and GetStage. setAge takes as

argument monthsToSet and sets the member field months. setAge returns void. getStage is a const member function that takes no argument and returns a string "Puppy" if the dog is less than 9 months old, "Adolescence" if more than 9 and less than 13 months, "Adulthood" if more than 13 and less than 60 months and "Senior" otherwise. The main should create a Dog called Buddy, set its age to 14 and cout the string returned by GetStage.

Computers and Technology
1 answer:
expeople1 [14]3 years ago
3 0

Answer:

see explaination

Explanation:

#include <iostream>

using namespace std;

class Dog {

int months;

public:

void SetAge(int mnths);

string GetStage() const;

//FIXME: Add declarations of member functions and fields

};

//FIXME: Add definitions of member functions

void Dog::SetAge(int mnths)

{

months = mnths;

}

string Dog::GetStage() const

{

if(months<9)

return string("Puppy");

else if(months<13)

return string("Adolescence");

else if(months<60)

return string("Adulthood");

else

return string("Senior");

}

int main() {

Dog buddy;

buddy.SetAge(14);

cout << buddy.GetStage();

return 0;

}

See attachment for screenshot and output.

You might be interested in
Which exercise can help you prevent Carpel Tunnel Syndrome?
g100num [7]
Make a Fist, hold, and stretch your fingers is the correct answer
8 0
4 years ago
Read 2 more answers
Which topology requires a multipoint connection?
Nina [5.8K]
It's C) Bus Bus topology requires a multipoint connection
5 0
4 years ago
Circuit continuity is checked using the___ function of a multimeter
Phantasy [73]
I usually use the Ohm meter to check for resistance. If the circuit completes, the measurement is negligible.
5 0
3 years ago
An operating system
marusya05 [52]

Answer: Allotment of resources to the running programs

Explanation:

Operating system is the software sectors of the computing device that helps in control and management of software, hardware and programming functions. It helps in allotment of requirements to same time or individually running programs through coordination.

  • Example-mac-OS, Linux,Microsoft Windows etc.
  • Other options are incorrect because operating system is not activates in the computer unit for every single execution. It is a software unit and does not monitors program execution for same time period.
3 0
3 years ago
A _______ network is the most secure and is less likely to be hacked because of few access points. Question 1 options: A. wired
densk [106]
The answer would be a wired network
5 0
3 years ago
Other questions:
  • What is it called when someone attempts to befriend you online for the purpose of stealing confidential or sensitive information
    10·1 answer
  • Which of the following options would you use when saving a document with a new filename? *
    12·2 answers
  • Convert each of the following bit patterns into whole numbers. Assume the values are stored
    14·1 answer
  • The process in which access looks for records in a table based on the fields and criteria in the query design, finds those recor
    6·1 answer
  • Jamie is writing an investigative report with footnotes
    9·2 answers
  • 23
    15·1 answer
  • When water reaches the pole, most of it turns to ice. Some salt is trapped between ice crystals, but most is left behind in the
    7·2 answers
  • PLEASEEEE PLEASEEE HELPPPP
    15·1 answer
  • Create a timeline of the evolution of computers.<br><br> Doesn’t have to be extra or super detailed
    9·2 answers
  • Declare a variable named
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!