PPL Assignment
IRM2015006
normalgirl.cpp
Go to the documentation of this file.
1 #include "normalgirl.h"
2 
3 #include <cmath>
4 #define BASE 1.1
5 
6 NormalGirl::NormalGirl(std::string name, int attr, int intel, int budget, BoyType boy_type)
7 {
8  this->name = name;
9  this->attr = attr;
10  this->intel = intel;
11  this->budget = budget;
12  this->boy_type = boy_type;
13  this->committed = false;
14  this->boyfriend = NULL;
15  this->gifts = NULL;
16  this->happiness = 0;
17 }
18 
20 {
21  float happiness = 0;
22  if (!this->gifts)
23  return -1;
24 
25  for (auto it = gifts->begin();
26  it != gifts->end();
27  it++) {
28  happiness += it->price + it->value;
29  }
30  this->happiness = happiness;
31  return this->happiness;
32 }
33 
35 {
36  return nature;
37 }
BoyType
Definition: girl_type.h:12
std::string name
Definition: girl.h:24
float happiness
Definition: girl.h:28
Boy * boyfriend
Definition: girl.h:30
static const GirlNature nature
Definition: normalgirl.h:12
std::vector< Gift > * gifts
Definition: girl.h:32
BoyType boy_type
Definition: girl.h:29
float getHappiness() override
Definition: normalgirl.cpp:19
GirlNature
Definition: girl_type.h:5
int attr
Definition: girl.h:25
NormalGirl(std::string name, int attr, int intel, int budget, BoyType boy_type)
Definition: normalgirl.cpp:6
int budget
Definition: girl.h:27
GirlNature getNature() override
Definition: normalgirl.cpp:34
bool committed
Definition: girl.h:23
int intel
Definition: girl.h:26