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

  1. sumIndex keeps track of people’s satisfaction
  2. sumUpRequest keeps track of the total up requests satisfied
  3. sumDownRequest keeps tracks of the total down requests satisfied
  4. sumExploded keeps track of exploded people
  5. sumIdle keeps tracks of all idle elevators throughout gameplay

Note that “good” performance means trying to maximize sumIndex, sumUpRequest, and sumDownRequest, while trying to minimize sumExploded and sumIdle.

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: