fp-elevators
SatisfactionIndex.cpp
Overview
SatisfactionIndex
is a class declared in SatisfactionIndex.h
. The sole purpose of this class is to maintain data about how the elevators are performing throughout gameplay.
The entirety of this class has been implemented for you,
so you should not change any of the code in either SatisfactionIndex.cpp
or SatisfactionIndex.h
. However, you should read the RMEs and implementations of the functions to understand what they do in order to know how they fit into the broader scope of the project for Game.cpp
.
Satisfaction Benchmarks
sumIndex
keeps track of people’s satisfactionsumUpRequest
keeps track of the total up requests satisfiedsumDownRequest
keeps tracks of the total down requests satisfiedsumExploded
keeps track of exploded peoplesumIdle
keeps tracks of all idle elevators throughout gameplay
Note that “good” performance means trying to maximize
sumIndex
,sumUpRequest
, andsumDownRequest
, while trying to minimizesumExploded
andsumIdle
.
One function in particular will be important to you: SatisfactionIndex::printRawSatisfaction
This function will print the raw satisfactions scores in the same order as the list above. This function has also been overloaded for you with the << operator
. This provides useful functionality where you can use cout
to print all of the member variables in the order above without having to explicitly write all of the code. In the example below, an object of the SatisfactionIndex
class is created (benchmarks
), and initialized using the default constructor to have default variables (0
). Then, each of these are printed using cout
with the overloaded operator <<
.
SatisfactionIndex benchmarks;
cout << "Result:" << endl;
cout << benchmarks << endl;
// Output:
Result:
0
0
0
0
0