/
Animal.cpp
79 lines (62 loc) · 1.48 KB
/
Animal.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*************************************************************************
** Author: Chelsea Hicks
** Date: 2/3/19
** Description: The source code file for the Animal parent class, which
** defines the getter and setter functions to be inherited
** by the child classes Penguin, Tiger, and Turtle.
*************************************************************************/
#include <iostream>
#include "Animal.hpp"
using std::cout;
using std::cin;
using std::endl;
//Default constructor -- declared but never defined
Animal::Animal()
{
}
//Setter and getter functions for the age of an animal
void Animal::setAge(int ageIn)
{
age = ageIn;
}
int Animal::getAge()
{
return age;
}
//Setter and getter functions for the cost of an animal
void Animal::setCost(float costIn)
{
cost = costIn;
}
float Animal::getCost()
{
return cost;
}
//Setter and getter functions for the number of babies an animal has
void Animal::setBabies(int babiesIn)
{
babies = babiesIn;
}
int Animal::getBabies()
{
return babies;
}
//Setter and getter functions for the food cost of an animal
//Base food price is $10
void Animal::setFoodCost(float multiplier)
{
foodCost = BASE_FOOD_COST * multiplier;
}
float Animal::getFoodCost()
{
return foodCost;
}
//Setter and getter functions for the payoff per day of an animal
void Animal::setPayoff(float payoffIn)
{
payoff = payoffIn;
}
float Animal::getPayoff()
{
return payoff;
}