6:27 illus Task 1 - Record Manager Instructions This task is the extension of the Lab 08 - Highscore table. Description
Posted: Sat May 14, 2022 3:27 pm
6:27 illus Task 1 - Record Manager Instructions This task is the extension of the Lab 08 - Highscore table. Description In this task, you are given the class RecordManager and you are to implement the method generateUpdatedRecords(Game Record[], GameRecord). The method compares the old game records with the new game records and returns a GameRecord array containing the most updated game records. Here is the list of parameters of the method: Parameter Name Parameter Type Description oldRecords GameRecord [] The Game Record my holding up to
6:27 LTE E Here is the list of parameters of the method: Parameter Parameter Name Type Description old Records GameRecord[The GameRecord array holding up to 10 best records for each level from the previous game played. These records are sorted from the highest to the lowest level and from the highest to the lowest score within each level. This array contains no empty/null entries. If there are less than 10 records for a level, only the corresponding number of records for that level would be stored in the array. For example, if we have 10 level-3 records, 2 level-2 records and 10 level-1 records, the array will have a size of 22. No tan amn
6:27 LTE E No two game records in the array have the same name, level and score. newRecord GameRecord The new game record from the current game play. The rules for generating the updated game record array are as follows: 1. If there is an old record with the same player's name and level as the new record, compare these two records and return an array containing the one with a higher score and all the remaining old records. 2. If there are no old records with the same name and level as the new record and the number of old records having the same level as the new record is less than 10,
6:27 LTE E the new record is less than 10, return an array containing the new record and all the records in the old record array. 3. If there are no old records with the same name and level as the new record and the number of old records having the same level as the new record is 10, return an array containing: 1) the 10 highest score records among the 10 old records of the same level and the new record, and 2) all the remaining records in the old record array with different level as the new record. You can assume that the GameRecord array containing the old records will only contain at most 30 GameRecords, 10 GameRecords for each level. To aid your understanding, here is a diagram showing the logic for generating the updated game record array:
6:27 LTE E the new record heter than the wind recebe old and new record in the ins Assumptions Assume that there is a method sort(GameRecord[]) in the Util class which can be called directly to sort a GameRecord array. The sorting will be from highest to lowest level and within each level, from highest to lowest score. As an example, assume we have a GameRecord array with name arr1, the following code will perform sorting on the array: Util.sort(arri); Location of the relevant class
6:27 ilE + The Record Manager class is in the package comp 102x.project.task. You can locate the RecordManager class by navigating through the folders: comp102x -> project -> task in the downloaded project template. Submission The declaration of the method is already given: public GameRecord [] updateGameRecords (GameRecord[ ] oldRecords, GameRecord newRecord) { // Please write your code after this line } you only need to complete the
6:27 LTE E } you only need to complete the body of the method in the PROJECT GRADED TASK 1 textbox below. Project Graded Task 1 0.0/30.0 points (graded) 1// Please write your code after this ling 2 Press ESC then TAB or click outside of the code editor to exit Unanswered
6:27 LTE E Here is the list of parameters of the method: Parameter Parameter Name Type Description old Records GameRecord[The GameRecord array holding up to 10 best records for each level from the previous game played. These records are sorted from the highest to the lowest level and from the highest to the lowest score within each level. This array contains no empty/null entries. If there are less than 10 records for a level, only the corresponding number of records for that level would be stored in the array. For example, if we have 10 level-3 records, 2 level-2 records and 10 level-1 records, the array will have a size of 22. No tan amn
6:27 LTE E No two game records in the array have the same name, level and score. newRecord GameRecord The new game record from the current game play. The rules for generating the updated game record array are as follows: 1. If there is an old record with the same player's name and level as the new record, compare these two records and return an array containing the one with a higher score and all the remaining old records. 2. If there are no old records with the same name and level as the new record and the number of old records having the same level as the new record is less than 10,
6:27 LTE E the new record is less than 10, return an array containing the new record and all the records in the old record array. 3. If there are no old records with the same name and level as the new record and the number of old records having the same level as the new record is 10, return an array containing: 1) the 10 highest score records among the 10 old records of the same level and the new record, and 2) all the remaining records in the old record array with different level as the new record. You can assume that the GameRecord array containing the old records will only contain at most 30 GameRecords, 10 GameRecords for each level. To aid your understanding, here is a diagram showing the logic for generating the updated game record array:
6:27 LTE E the new record heter than the wind recebe old and new record in the ins Assumptions Assume that there is a method sort(GameRecord[]) in the Util class which can be called directly to sort a GameRecord array. The sorting will be from highest to lowest level and within each level, from highest to lowest score. As an example, assume we have a GameRecord array with name arr1, the following code will perform sorting on the array: Util.sort(arri); Location of the relevant class
6:27 ilE + The Record Manager class is in the package comp 102x.project.task. You can locate the RecordManager class by navigating through the folders: comp102x -> project -> task in the downloaded project template. Submission The declaration of the method is already given: public GameRecord [] updateGameRecords (GameRecord[ ] oldRecords, GameRecord newRecord) { // Please write your code after this line } you only need to complete the
6:27 LTE E } you only need to complete the body of the method in the PROJECT GRADED TASK 1 textbox below. Project Graded Task 1 0.0/30.0 points (graded) 1// Please write your code after this ling 2 Press ESC then TAB or click outside of the code editor to exit Unanswered