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
Why do you need to cite your sources? (check all that apply)
Shalnov [3]

the answer to this is  2 and 3

Hope this helped

-scav

4 0
3 years ago
Which of the following statements is true about scalability? Choose 3 options.
Simora [160]

Answer:

4, 5, 2

Explanation:

just did it on edge :)

3 0
3 years ago
Read 2 more answers
Given an array a, declared to contain 34 elements, write an expression that refers to the last element of the array.
Mice21 [21]
If the language is zero indexed:

a[ 33 ]
4 0
3 years ago
Which of the following is NOT a Creative Commons license?
iogann1982 [59]
Commercial use is not a creative commons license
6 0
3 years ago
When a piece of shiny silver jewelry gets tarnished, what has happened?
makvit [3.9K]
A
because if you leave certain metals in the rain they tarnish or rust. think about how if you leave a bike in the rain for too long it will start to rust on the metal parts
6 0
3 years ago
Other questions:
  • Susie works for an architectural firm and the partners have always drawn the plans for projects by hand. Though Susie learned ho
    8·1 answer
  • This type of connection uses radio waves to connect devices on a network.
    15·2 answers
  • At age 16 Cheyanne just got her drivers license
    5·2 answers
  • If you were setting up a network with 100 nodes and you wanted no more than 25 nodes per segment: what devices and connections w
    9·1 answer
  • Place the steps in order to link and place text into the document outline, effectively creating a master document.
    8·1 answer
  • ____ is a bundled set of communications services, including internet, telephone, and tv, that operates over a total fiber-optic
    5·1 answer
  • Which part of the operating system enables you to interact with the device? Question 9 options: The graphical user interface The
    8·1 answer
  • Write a program to read a list of exam scores given as integer percentages in the range O to 100. Display the total number of gr
    11·1 answer
  • Choose the answer that best completes the
    8·2 answers
  • In what machines, places and apparatus are dimmers used in? Put at least 5 examples
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!