i think i done step one on bluej but im stuck on step 2 which says add two fields which stores the nickname.....
this really makes me confuse :confused:
below is what i have to be doing codes on bluej
The basic Game class should have
• three fields, title, objective (of the game) and cost (in pence of each download);
• a constructor, which allows you to pass arguments to initialise these three attributes;
• accessor and mutator methods for each field as well as a printReport() method which outputs the title and objective of the game as well as the cost of each download.
Step 2: adding functionality to the Game class.
For this step, you should
• write a method download() which allows a user to "download a copy of the game". Since this is only a model, at the moment, all we do is output a message which congratulates the user on their download and reminds them of the cost. It also updates the value of a new field noOfDownloads;
• add two fields which store the nickname of the player with the best score as well as the score itself respectively;
• write a method checkScore() which, when given a player's score and name, checks to see whether that particular score is the best score to date and if so, replaces the best score with this new score and also replaces the relevant nickname.
Do not forget to amend your printReport() method to include the new information collected in this step.
So far, testing of the program has been quite repetitive and always starts from scratch. However, we could introduce a default constructor with the field values hard-coded. This means that when we create our object and then call this default constructor, it is as though our object has been in existence for some time. This will help particularly with your testing. Introduce a second, default constructor now.
• write a method calculateEarnings() which calculates how much money this particular game has earnt its writer;
o do not add an extra field to keep track of the running earnings total.
• Now amend your printReport() method to include this new information i.e. the earnt money, again without creating any new field(s).
Introduce a new class, called Manager, to the project. Its purpose is to represent the manager of the game. It should have
• two fields surname and managerID;
• a suitable constructor and accessor methods.
Next add a new field gameManager, of type Manager, to the Game class. Modify Game's constructor by giving it an additional parameter so that the new field can be initialised when the constructor is called.
To test your code
• create a Manager object;
• create a Game object, and pass to its constructor
o values for the three fields (as usual);
o the identifier for the Manager object e.g. manager1 (or, more easily, click on the Manager object on the Object Bench);
• inspect the Game object using the Object Inspector. If you double click on the gameManager field, a new Object Inspector window will open and you should see the fields of the Game object you created -- this will confirm that your code for Step 4 is working correctly.
Now amend the printReport()method of the Game class so that it also outputs the surname of the manager.