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]
2 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]2 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
What is the approximate time and death in Sherlock Holmes
kati45 [8]

Answer: 8:58.5204 o'clock a.m

:)

3 0
2 years ago
Read 2 more answers
The study of the production and distribution of goods and services and their management is:
kramer

Answer:

the study of the production and distribution of goods and services and their management is

Explanation:

thats all you said

8 0
3 years ago
What are examples of real-time applications
Savatey [412]

Typical examples of real-time systems include Air Traffic Control Systems, Networked Multimedia Systems, Command Control Systems etc.

3 0
3 years ago
What should htc's os strategy be? should it stick with windows mobile and android? should htc build its own platform? add/drop o
rosijanka [135]

I say windows, since it is very common.

8 0
3 years ago
The link between violence in the media and school shootings has been proven to be direct. True/false?​
Sveta_85 [38]

Answer:

most of the time a school shooting will be done by a kis that has been bullied and picked on a lot (aka the quiet kid ) if we could stop bullying we could decreese the number of school shootins by a lot

Explanation:

8 0
2 years ago
Other questions:
  • Given main(), define the Team class (in file Team.java). For class method getWinPercentage(), the formula is:teamWins / (teamWin
    15·1 answer
  • PLEASE HELP ITS DRIVERS ED
    8·2 answers
  • How to revert a dismissed javascript popup alert box in chrome?
    5·1 answer
  • At one college, the tuition for a full-time student is $6,000 per semester. It has been announced that the tuition will increase
    12·1 answer
  • Do debit cards offer the highest level of fraud pretection?
    10·1 answer
  • Please give me correct answer<br><br>please give me very short answer​
    13·1 answer
  • What is the output?
    7·1 answer
  • Discuss TWO changes in ICMP that took place with the development of IPV6 and indicate why those changes were made.
    7·1 answer
  • I WILL GIVS BRAINLIEST IF U ANSWER THIS
    9·1 answer
  • What do you understand by cloud computing? list the advantages of clould computing.​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!