-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPet.h
35 lines (26 loc) · 944 Bytes
/
Pet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef PET_H
#define PET_H
#include <iostream>
#include <string>
// Pet class definition
class Pet
{
public:
std::string name; // Name of the pet
int hunger; // Pet's hunger level
int happiness; // Pet's happiness level
// Constructor to initialize the pet's name and set initial hunger and happiness levels
Pet(std::string petName);
// Method to feed the pet, increasing its hunger level
void feed();
// Method to play with the pet, increasing its happiness level
void play();
// Method to check and display the pet's current hunger and happiness levels
void checkStatus();
// Method to check if the pet is still alive (hunger and happiness are above zero)
bool isAlive() const;
private:
// Method to decrease both hunger and happiness levels
void decreaseLevels(std::string state);
};
#endif