#ifndef HIGHSCORES_H_
#define HIGHSCORES_H_
using namespace std;
/**
* Class HighScores stores a list of high scores for a game.
*
*/
class HighScores {
public:
static const int DEFAULT_NUMBER_OF_SCORES;
static const string DEFAULT_TITLE;
/**
* Default constructor: no arguments.
* sets default values for the instance variable
*/
HighScores();
/**
* Constructor:
* parameters:
* title: the title of this high score list.
* number: the maximum number of high scores to be stored
* highestBest: determines the order of the scores
* true: The best score will be the highest (e.g. pinball)
* false: The best score will be the lowest (e.g. golf)
*/
HighScores(string title, int number, bool highestBest);
/**
* Destructor: clean up resources
*/
virtual ~HighScores();
/**
* addScore: Add a player's name and score to the list if it is
* good enough to merit being a high score.
* parameters:
* name: the name of the player
* score: the player's score
* return value:
* true if the player and score are added to the list
* false if the score was not good enough to make the list
*/
bool addScore(string name, int score);
bool isHighScore(int score) const;
/**
* clearScores: empty the high scores so there are no longer any stored.
*/
void clearScores();
/**
* totalScores: the number of scores stored. Note: this will be less than
* or equal to the maximum.
* return value: the total number of high scores that are stored.
*/
int totalScores();
/**
* readFromFile: read the high score data from the file given
* by the filename.
* parameter: filename the name of the file to be read
* return value:
* true: the file was successfully opened and read
* false: the file open or read failed.
*
*/
bool readFromFile(const string &filename);
/**
* writeToFile: write the high score data to a file given
* by the filename.
* parameter: filename the name of the file to be read
*/
void writeToFile(const string &filename) const;
/**
* print: print the contents of this high score table to cout
*/
void print() const;
};
#endif