Kyle's Doxygen Test
This is just a test of Doxygen
|
Represents a dog. More...
#include <dog.hpp>
Public Member Functions | |
Dog (const char *_name) | |
Creates a new Dog. | |
void | bark (void) |
Causes the dog to bark. | |
void | run (int minutes) |
Causes the dog to run. | |
void | sleep (int minutes) |
Causes the dog to sleep. | |
Protected Member Functions | |
bool | checkEnergy (int energyToExpend) |
Checks the dog's energy. | |
Private Attributes | |
const char * | name |
The dog's name. | |
int | energy |
The dog's available energy. | |
Represents a dog.
This class keeps track of the dog's energy level, and performs actions for the dog based on how much energy it has. Sleeping regains energy for the dog, while barking and running use energy up.
Dog::Dog | ( | const char * | _name | ) |
void Dog::bark | ( | void | ) |
Causes the dog to bark.
Causes the dog to bark if it has enough energy to do so. Barking costs 1 energy to do. If the dog does not have enough energy, then the bark fails.
Definition at line 10 of file dog.cpp.
References checkEnergy(), energy, and name.
Referenced by testDog().
|
protected |
Checks the dog's energy.
Compares an amount of energy with the dog's current available energy. This function can be used to determine if the dog is able to take an action that costs energy.
energyToExpend | An amount of energy to check. |
Definition at line 50 of file dog.cpp.
References energy.
Referenced by bark(), and run().
void Dog::run | ( | int | minutes | ) |
Causes the dog to run.
Causes the dog to run for an amount of time if it has enough energy to run for that long. If the dog does not have enough energy, then the run fails. If the dog cannot complete the full run, no running takes place and no energy is expended. Running costs 3 energy per minute.
minutes | Number of minutes for the dog to run. |
Definition at line 20 of file dog.cpp.
References checkEnergy(), energy, multiply(), and name.
Referenced by testDog().
void Dog::sleep | ( | int | minutes | ) |
Causes the dog to sleep.
Sleeping replenishes the dog's energy. The dog regains an amount of energy equal to twice the number of minutes slept. The dog will always sleep, regardless of how much energy it has remaining.
minutes | Number of minutes for the dog to sleep. |
Definition at line 37 of file dog.cpp.
References energy, MAX_ENERGY, multiply(), and name.
Referenced by testDog().
|
private |
The dog's available energy.
Represents the amount of energy the dog has available. This is set in the constructor and should not be accessed externally. Taking actions that cost the dog energy will cause this value to drop, and sleeping will cause this value to rise.
Definition at line 89 of file dog.hpp.
Referenced by bark(), checkEnergy(), Dog(), run(), and sleep().
|
private |