C++ Pet Class You are going to organize and show information about pets in a Pet Store using a Pet class. The Pet class You need to make a Pet class that holds the following information as private data members: the name of the pet (e.g. "Spot", "Fluffy", or any word a user enters) the type of pet (e.g. dog, cat, snake, hamster, or any word a user enters) level of hungriness of the pet (2 means hungry, 1 means content, 0 means full) Your class also needs to have the following functions: a default constructor that sets the pet to be a dog named Buddy, with level of hungriness being “content” a parameterized constructor to allow having any type of pet the order of the parameters is: name of the pet, type of pet, hungriness level a PrintInfo function that prints the info for the pet according to the sample output below a TimePasses function that increases the hungry level of the pet by one (unless its hungry level is already 2, meaning hungry). a FeedPet function that changes the hungry level of the pet to 0 (Full) You must write your class in separate .h and .cpp files.  Sample Output For a default pet (dog, named “Buddy”, content): A dog named Buddy who is hungry level 1. For a pet cat named Fluffy, who is content:: A cat named Fluffy who is hungry level 1. For a hamster named Sparky who is full: A hamster named Sparky who is hungry level 0.   I need to provide Main.cpp, Pet.h, and Pet.Cpp. I am given Main.cpp, constants for Pet.h. No information given for Pet.cpp. Main.cpp (no changes needed here!)-  #include "Pet.h" int main() {Pet firstPet;Pet secondPet("Fluffy", "cat", CONTENT_HUNGRY); firstPet.PrintInfo(); secondPet.PrintInfo();secondPet.TimePasses();secondPet.PrintInfo();secondPet.FeedPet();secondPet.PrintInfo(); Pet thirdPet("Sparky", "hamster", NOT_HUNGRY);thirdPet.PrintInfo();return 0;}   Pet.h: I must add to it but use these constants- const int NOT_HUNGRY = 0;const int VERY_HUNGRY = 2;const int CONTENT_HUNGRY = 1; Pet.cpp: No given information.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++

Pet Class

You are going to organize and show information about pets in a Pet Store using a Pet class.

The Pet class

You need to make a Pet class that holds the following information as private data members:

  • the name of the pet (e.g. "Spot", "Fluffy", or any word a user enters)
  • the type of pet (e.g. dog, cat, snake, hamster, or any word a user enters)
  • level of hungriness of the pet (2 means hungry, 1 means content, 0 means full)

Your class also needs to have the following functions:

  • a default constructor that sets the pet to be a dog named Buddy, with level of hungriness being “content”
  • a parameterized constructor to allow having any type of pet
    • the order of the parameters is: name of the pet, type of pet, hungriness level
  • a PrintInfo function that prints the info for the pet according to the sample output below
  • a TimePasses function that increases the hungry level of the pet by one (unless its hungry level is already 2, meaning hungry).
  • a FeedPet function that changes the hungry level of the pet to 0 (Full)

You must write your class in separate .h and .cpp files. 

Sample Output

For a default pet (dog, named “Buddy”, content):

A dog named Buddy who is hungry level 1.

For a pet cat named Fluffy, who is content::

A cat named Fluffy who is hungry level 1.

For a hamster named Sparky who is full:

A hamster named Sparky who is hungry level 0.

 

I need to provide Main.cpp, Pet.h, and Pet.Cpp. I am given Main.cpp, constants for Pet.h. No information given for Pet.cpp.

Main.cpp (no changes needed here!)- 

#include "Pet.h"

int main() {
Pet firstPet;
Pet secondPet("Fluffy", "cat", CONTENT_HUNGRY);

firstPet.PrintInfo();

secondPet.PrintInfo();
secondPet.TimePasses();
secondPet.PrintInfo();
secondPet.FeedPet();
secondPet.PrintInfo();

Pet thirdPet("Sparky", "hamster", NOT_HUNGRY);

thirdPet.PrintInfo();

return 0;
}

 

Pet.h:

I must add to it but use these constants-

const int NOT_HUNGRY = 0;
const int VERY_HUNGRY = 2;
const int CONTENT_HUNGRY = 1;

Pet.cpp:

No given information.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education