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 term refers to actions that you would typically perform on a computer to revive it if it functions in an unexpected manner
andriy [413]
There are many answers to this question. The first step is normally a reboot, second, I would check witch task or service is taking up all the CPU cycles and check the system and error logs. The list goes on... I'm not sure how detailed you want to get.
5 0
3 years ago
Read 2 more answers
Help please! I need help with this question, it’s very hard.
sasho [114]

Answer:

1. PRINTER

2.Proj

3.USB

4.CAM

7 0
3 years ago
Visual basis,C, C++ and Java are all examples of computer programming ________.
mafiozo [28]
Programming languages im pretty sure
4 0
3 years ago
You have just started a new job as the administrator of the eastsim domain. The manager of the accounting department has overhea
Luda [366]

Explanation:

To implement the desired password policy, you have to carry out these steps

1. An organizational unit, OU has to be created for these employees in east-sim.com

2. Since there is an organizational unit created for the accounting employees, you have to put the employees user objects in this Organizational unit.

3. Then as the administrator the next step that i would take is the configuration of the password policy, then i would link this to the already created organizational unit for these employees

3 0
2 years ago
Get ready to be the Quizmaster! You are going to design your own Python game show in the style of a quiz.
horrorfan [7]

Answer:

Cant u just make a kahoot IoI

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • If a cache access requires one clock cycle and dealing with cache misses requires an additional five clock cycles, which of the
    9·1 answer
  • What are some good editing software apps for pc?
    11·1 answer
  • _____ view focuses on the text and content of a document, without much information on the page layout
    15·1 answer
  • Enter a formula in cell b7 to calculate the average value of cells b2:b6
    13·1 answer
  • Once a software program has been through one test cycle performed by the programmers and is running proper
    10·1 answer
  • Question 3 of 10
    13·1 answer
  • A class is a _____, which encapsulates _____ and _____. (Points : 2) programming language construct; attributes; behavior
    7·1 answer
  • Why can it be helpful to perform mathematical calculations using programming? Choose the best answer.
    11·1 answer
  • Which storage is faster than secondary storage​
    14·2 answers
  • which one of the following will reach every element in the array a? 1. for(int i = 0; i &lt;= a.length; i++) 2. for(int i = 0; i
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!