-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.h
223 lines (187 loc) · 4.86 KB
/
Header.h
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#ifndef HEADER_H
#define HEADER_H
#include <iostream>
#include <vector>
#include <string>
#include <random>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
const int NUM_ISSUES = 5;
class Stance {
private:
int _significance[NUM_ISSUES];
int _approach[NUM_ISSUES];
public:
Stance();
int getSignificance(int index) const;
void setSignificance(int index, int value);
int getApproach(int index) const;
void setApproach(int index, int value);
void print() const;
};
class Issue {
private:
string _name;
Stance _stance;
public:
Issue(string name, Stance stance);
string getName() const;
void setName(const string &name);
Stance& getStance();
void setStance(const Stance &stance);
const Stance& getStance() const;
};
class CampaignMember {
private:
//The popularity for both leader and candidates
double _popularity;
vector<Issue> stances;
public:
CampaignMember();
double getPopularity() const;
void setPopularity(double value);
void updatePopularity(double delta);
};
class Leader : public CampaignMember {
private:
//external variable for leader
double _influence;
public:
Leader();
double getInfluence() const;
void setInfluence(double value);
// void print() const;
};
class Candidate : public CampaignMember {
private:
//external variable for candidates
double _loyalty;
Stance _stance;
public:
Candidate();
double getLoyalty() const;
void setLoyalty(double value);
const Stance& getStance() const;
// void print() const;
};
class ManagementTeam {
private:
//external variable for team
double _efficiency;
public:
ManagementTeam();
double getEfficiency() const;
void setEfficiency(double value);
// void print() const;
};
class Party {
private:
//Call of relate objects in parties
string _name;
Leader _leader;
ManagementTeam _team;
vector<Issue> _issues;
Stance _partyStance;
public:
Party(string name, Leader leader, vector<Candidate> candidates, ManagementTeam team);
string getName() const;
void setName(const string &name);
Leader& getLeader();
void setLeader(const Leader &leader);
const vector<Candidate>& getCandidates() const;
void setCandidates(const vector<Candidate>& candidates);
vector<Candidate> _candidates;
ManagementTeam getManagementTeam() const;
void setManagementTeam(const ManagementTeam& team);
const vector<Issue>& getIssues() const;
void setIssues(const vector<Issue>& issues);
void addIssue(const Issue& issue);
// void print() const;
};
class Electorate {
private:
//Order of divisions with issues
int divisionNumber;
std::vector<Issue> issues;
public:
Electorate(int division);
~Electorate();
int getDivisionNumber() const;
vector<Issue>& getIssues();
const vector<Issue>& getIssues() const;
void addIssue(const Issue &issue);
};
class Event {
public:
Event();
};
class Debate: public Event {
private:
string _debateEve;
public:
string getDebateEve();
void setDebateEve(const string& debateEve);
void debateType(Party& party1, Party& party2, Party& party3);
};
class Leader1 : public Event{
private:
string _leaderEve1;
public:
string getLeaderEve1();
void setLeaderEve1(const string& leaderEve1);
void Leader1Type(Party& party1, Party& party2, Party& party3);
};
class Leader2 : public Event{
private:
string _leaderEve2;
public:
string getLeaderEve2();
void setLeaderEve2(const string& leaderEve2);
void Leader2Type(Party& party1, Party& party2, Party& party3);
};
class Candidate1 : public Event{
private:
string _canEve1;
public:
string getCanEve1();
void setCanEve1(const string& canEve1);
void Candidate1Type(Party& party1, Party& party2, Party& party3);
};
class Candidate2 : public Event{
private:
string _canEve2; // No need for "std::"
public:
string getCanEve2();
void setCanEve2(const string& canEve2);
void Candidate2Type(Party& party1, Party& party2, Party& party3);
};
class Issue1 {
private:
string _issueEve1;
public:
// Getter for _issueEve1
string getIssueEve1() ;
// Setter for _issueEve1
void setIssueEve1(const string& issueEve1);
void simulateData(Electorate& electoralDiv);
};
class Issue2 {
private:
string _issueEve2;
public:
string getIssueEve2() ;
void setIssueEve2(const string& issueEve2);
void simulateData(Electorate& electoralDiv);
};
//External functions for simulation
extern vector<Party> parties;
extern vector<Electorate> electorates;
double calculateInDebate(const Party& party, int candidateIndex);
double sum (int val1, int val2);
double computeVotingScore(const Candidate& candidate, const Electorate& electorate, const Leader& leader);
void decideWinner();
void createObj(int electorateNumber);
void showInfo(int electorateNumber, int day);
#endif