The task is to design and develop a prototype for one of the features of an application which tracks the performance of the players.
The Application features a game with a number of levels; on successful completion of a level, a player moves to the next level. Players can register directly with the app itself or by supplying identification information from one of a number of linked social media apps.
Player data is stored in a single file either as delimited text format or object file. Player details are Id, Player Name, Image Filename, Current Level, Number of Attempts at Current Level, and, Total Points earned. For social media players the social media app name and identifier are stored.
Requirements
Develop a project with console menu-driven application. The project should contain a controller class with stubs for methods implementing the requirements listed below:
1. Load player performance information from a specified file into a players collection implemented using a repository
2. Add a new player with default values for current level, attempts and points and remove a player from the list.
3. List all players in ascending order of overall points earned
4. Update a player’s performance data after an attempt at a level – overall points earned should be updated. On successful completion of a level the player should move to the next level and attempts returned to 0; otherwise, number of attempts should be incremented
5. Persist the collection to a specified file
The project should contain a model, repository and controller classes. A sample delimited text file is additionally supplied.
Development Approach
An incremental development approach should be used with the following increments:
- Load players from a file and list in name order
This fulfils Requirement 1. To complete this increment you should:
a. Complete the Player and SocialMediaPlayer classes with required fields and methods
b. Decide on which type of collection you want the repository to define and make the necessary adjustments to the Repository class and RepositoryInterface.
c. Partially complete the GameController class by completing the constructor method which creates a new Repository object from a file if specified by the user
d. Partially complete the GameController class to implement the listPlayers() method
e. Create a DAOImpl class to realize the DAOInterface using either text file or object file format
f. Modify the Repository class to use the DAOImpl class to load players from a specified file
Document the results of your testing using screen snippets copied into a Word document. Take a copy of the GameController class and name it as GameController_Increment1.java.
- Add new Player
This fulfils Requirement 2. To complete this increment you should:
a. Fully implement the addPlayer() method in the GameController class; this should ask the user for required details, create a new Player or SocialMediaPlayer object and add it to the Repository object.
Document the results of your testing using screen snippets copied into a Word document. Take a copy of the GameController class and name it as GameController_Increment2.java.
3. Remove a player from the list
This fulfils Requirement 2. To complete this increment you should:
Enter the player id and remove player details from the list based on the entered id.
- List players in ascending order of points earned
This fulfils Requirement 3. To complete this increment you should:
a. Complete the listPlayersInPointsOrder() method in the GameController class.
b. Ensure the Player class defines a method to compare players on the totalPointsEarned attribute.
Document the results of your testing using screen snippets copied into a Word document. Take a copy of the GameController class and name it as GameController_Increment3.java.
- Update Player Performance Data
This fulfils Requirement 4. To complete this increment you should:
a. Complete the updatePlayer() method in the GameController class. The number of points earned in this attempt should be entered and whether or not the level has been completed.
Document the results of your testing using screen snippets copied into a Word document. Take a copy of the GameController class and name it as GameController_Increment4.java.
- Persist player collection to a file
This fulfils Requirement 5. To complete this increment you should:
a. Implement the store() method of the DAOImpl class if you have not already done so.
b. Implement any necessary toString(DELIMITER) methods.
Document the results of your testing using screen snippets copied into a Word document.
Marking Scheme
Marks
Player class
10
SocialMediaPlayer class
10
Repository class
5
DAOImpl class
5
Increment1 GameController class
10
Increment2 GameController class
10
Increment3 GameController class
5
Increment4 GameController class
5
Increment5 GameController class
5
Use of nested classes (inner/local/anonymous)
10
Use of abstract & generic classes
5
UML Class diagram
10
Use of lambda expressions
10
Total
100
Starter Project Test Run
run:
Game App
========
Players
=======
A. Add Player B. Remove Player C. List Players D. Update Player Q. Quit
Enter choice:
A
Add Player
==========
Players
=======
A. Add Player B. Remove Player C. List Players D. Update Player Q. Quit
Enter choice:
B
Remove Player
==========
Players
=======
A. Add Player B. Remove Player C. List Players D. Update Player Q. Quit
Enter choice:
C
Players
=======
A. Add Player B. Remove Player C. List Players D. Update Player Q. Quit
Enter choice:
D
Update Player
=============
Players
=======
A. Add Player B. Remove Player C. List Players D. Update Player Q. Quit
Enter choice:
Q
Thank you for using Game App. Good bye.
Sample Delimited Text File
1,”Saleh”,”salehpic.jpg”,20,2,1500
2,”Salim”,”salpic.jpg”,1,0,0,”MyBook”,”salim123@sal.com”
3,”Ibrahim”,”ibr.jpg”,15,1,100