Question: Question 6.3 Portfolio A.1+1 Download the existing Java Project that can be extracted from the Starting Player.zip file, and imported into Eclipse. This question forms

 Question 6.3 Portfolio A.1+1 Download the existing Java Project that can

Question 6.3 Portfolio A.1+1 Download the existing Java Project that can be extracted from the Starting Player.zip" file, and imported into Eclipse. This question forms the first part of Portfolio case study A. Your task is to create a Player class that is composed of a Name and PairOfDice, and also has a gamer tag (represented by a String). You are advised to use the Employee class as a guide. In next week's exercise, you will update the Player class, and be given some unit tests for this updated version, allowing you to assess your progress. Die PairOfDice Name Player getName() Name setName(Name) :void getPairoDice() PairoDice rolDice() void getDiceScore() sint a) The Player should have three fields - in addition to those representing its Name and PairOfDice, the third field of type String stores a hypothetical gamertag - this can be thought of as a custom username for the player. b) The class should have a default constructor, which assigns default values to each field, and two custom constructors - one that accepts a Name object and a gamertag (and assigns a default value for the PairOIDice), and another that accepts values for all three fields. c) As shown in the UML diagram, there should be get and set method for its Name and a get method for PairOfDice. It should also have a method called rollDice and getDiceScore that both simply delegate to the PairOfDice class, which already has this functionality. d) The class should also have a get method for the String-based gamertag, and a Page 4 of 8 CTEC2905 Object Oriented Design Exercise 6: Composition & Aggregation toString() method in the standard convention format. c) As this is a portfolio question, you should fully document thc Player class with Javadoc, i.e. class header, constructor/method description and tags where appropriate. . Notes - The principle of delegation: You have already seen how the PairOfDice class delegated to the Die class to roll both its dice and calculate their combined score - this is common practice when working with associations. When an aggregation relationship exists, the aggregate class (i.e. that which holds a collection) can take advantage of delegation by delegating responsibility to the internal data structure. For example the ArrayList class already has an add(...) method, so a Playlist class can simply delegate this task when adding a song to the internal list: public void addSong (Song s) { songlist.add(s); } You may wonder why you would build a class, where you are primarily delegating responsibility to another class. The benefit is you have created something new (in this case a PlayList), which only provides selected necessary functionality of an ArrayList and can additionally add functionality of its own

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!