PPL Assignment
IRM2015006
desperategirl.cpp
Go to the documentation of this file.
1 #include "desperategirl.h"
2 
3 #include <cmath>
4 #define BASE 1.1
5 
6 DesperateGirl::DesperateGirl(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 
29  happiness += pow(BASE, it->price);
30  }
31  this->happiness = happiness;
32  return this->happiness;
33 }
34 
36 {
37  return nature;
38 }
DesperateGirl(std::string name, int attr, int intel, int budget, BoyType boy_type)
BoyType
Definition: girl_type.h:12
#define BASE
std::string name
Definition: girl.h:24
float happiness
Definition: girl.h:28
static const GirlNature nature
Definition: desperategirl.h:12
Boy * boyfriend
Definition: girl.h:30
GirlNature getNature() override
std::vector< Gift > * gifts
Definition: girl.h:32
BoyType boy_type
Definition: girl.h:29
float getHappiness() override
GirlNature
Definition: girl_type.h:5
int attr
Definition: girl.h:25
int budget
Definition: girl.h:27
bool committed
Definition: girl.h:23
int intel
Definition: girl.h:26