High Score Class

due: Tuesday 2/3, 2015

Create a class for managing high scores and high score files. An object of the class will store a fixed number of scores which will consist of at least a name and a score. The class should be flexible enough to work in cases where the best score is the highest value and the best score is the lowest value.


Class specification

The files for this class should be HighScores.h and HighScores.cpp. The class should contain the following:
  1. The methods described in HighScores.h. Note: this file is incomplete.
  2. protected instance variables to store the data.
  3. public getters and setters where appropriate for instance variables.
  4. public methods for accessing individual names and scores. You may do any of the following.

Note: that each high score object will have its own maximum number of high scores that it stores. It may at any given point actually be holding fewer than this number, but it should never hold more.


File storage

The specification includes two methods for file access: readFromFile and writeToFile. You may define the file format however you would like, but be sure to include the title of the high score table and any additional information about the table itself along with the score data. You may find the method getLine useful for reading a title which may contain spaces.

Test program

Write a test program HighScoreTest.cpp to demonstrate that your HighScore class works. It should run without keyboard input. It should test every method in your class an demonstrate how to iterate through all of the high scores (part 4 of the class specification).

Grading

The program will be worth 50 points.
Topic Points Description
Code Format 5

Use good indenting. Don't have more than 80 characters on a single line. Use consistent capitalization. Generally, variables and function names are lower case. User defined types (such as classes) start with a capital letter. Constants are all capital letters.

Code Documentation 10

Although comments are important in making your code readable, you also want to make sure you use good, descriptive variable and function names. Certain variables, like the automatic variable "i" in a for loop can have short, commonly used names. Functions and method names should usually be verb phrases e.g. getTimeOfDay() and isGameOver().

Methods should be thoroughly documented in the .h file. This includes information about parameters and return types. This does not have to be repeated in the .cpp file.

You should also avoid magic "numbers" whenever reasonable to do so, use constants instead. The use of 0 or 1 is usually okay, but values such as 6, 3562 or '?' probably have some interesting meaning in your program and a (const) variable name is a great way to describe it.

Program Specifications 30

The class works more or less as specified. You may make modifications in the specifications in order to satisfy the functionality and creativity portion of the assignments.

The test program demonstrates the use of every public method in the class.

Functionality and Creativity 5

You MUST include some additional feature(s) in your high score table. Look at other games to see what additional information or features may be included.

Code that does not compile will get at most 5/50.

Submission

Submit the following files in Moodle. Do NOT submit any .o, executable or eclipse files.
  1. A README file that includes a description of additional feature that you implemented and any notes on compilation or execution.
  2. Any .cpp or .h files that you wrote. You may submit a zip file that contains these instead if you so choose.

Clif Presser<cpresser@gettysburg.edu>
Last modified: Wed Jan 28 12:33:56 EST 2015