-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animal.cpp
60 lines (51 loc) · 1.55 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
/* Justin Tromp
* Date: 01/21/2019
* Email: trompj@oregonstate.edu
* Description: Animal class is a parent class to four other classes. Class is set up to allow user to create an animal
* for zoo simulation game. Base variables used include animalCost, foodCost, animalRevenue, numberBabies, and animalAge.
* Member functions:
* animal - Default constructor sets up user animal object by base values of 0.
* getAnimalAge - Gets animal age value
* getAnimalCost - Gets animal cost value.
* getAnimalRevenue - Gets revenue generated by each animal.
* getFoodCost - Gets food cost.
* getNumberBabies - Gets the birth rate for animal.
* increaseAnimalAge - Increases age of animal by 1 day.
*/
#include "Animal.hpp"
//Set base constructor for animal
Animal::Animal() {
animalAge = 0;
animalCost = 0;
numberBabies = 0;
foodCost = 0;
animalRevenue = 0;
}
//Animal constructor to set age of animal from parameter
Animal::Animal(int inputAge) {
animalAge = inputAge;
}
//Get food cost and return value
double Animal::getFoodCost() {
return foodCost;
}
//Get animal revenue for day and return value
double Animal::getAnimalRevenue() {
return animalRevenue;
}
//Get number of possible babies and return value
int Animal::getNumberBabies() {
return numberBabies;
}
//Get animal cost and return value
double Animal::getAnimalCost() {
return animalCost;
}
//Get the age of the animal and return value
int Animal::getAnimalAge() {
return animalAge;
}
//Increases animal age by 1
void Animal::increaseAnimalAge() {
animalAge++;
}