You are being asked to design, implement and document a simple card game in the Java programming language. You are advised that in order to accomplish this assessment correctly you should use the techniques regarding class structure, object usage and data structures that have been taught to you during the lec-tures.
The first round of the game starts with all players having the same number of cards in their deck, and the cards are facing down (i.e. not visible to the players); all cards have a number of attributes, each attribute having a numerical value, e.g. a digit from 0 to 9 (inclusive).
Every player picks up a card from the top of their deck and looks at it.
The nominated first player then chooses an attribute, say Attribute i, to play with; all the players compare the values of this Attribute i on the cards they have picked up.
The player with the highest value wins the round, collects the cards that the oth-er players had picked up and puts them (together with his/her card) facing down at the bottom of his/her deck.
The next round starts with every player picking up the card on top of his/her deck and looking at it, and a next player (or random player or the previous winner etc) chooses the attribute they wish to play with.
The game continues in the same fashion for an unlimited number of rounds until only one player, the winner, has cards left in their deck.
CardGame is intended to be an application that simulates the above described card game with the following features:
Implement the CardGame functionality in Java (for a pass):
Implement the card game outlined above; using objects and good class struc-ture, create objects for the card, attribute player, game and of course the main class/method.
IMPORTANT: It is not necessary for this game to include any graphical output in the form of a GUI. The only output required is to the console/terminal as this is intended to be a text based game.
Card Class: This class should hold the attributes of a card in the deck.
Attribute Class: This class should hold the name and value of the attribute. All cards in a deck should have the same number of attributes.
Having an attribute as a class will allow you to dynamically create as many attrib-utes as you want for the cards in a deck. This class can be useful if at the begin-ning of the game you want to give a human user a choice of decks to play with. For example, in a Band deck all cards might have only 3 attributes including popularity, while in a Cars deck all cards might have 4 attributes including speed or price.
Player Class: This class should make the correct use of collections to hold a play-ers deck. It will also contain information about the player, for example the type of the player (human or computer). It might be useful to also have methods in this class that can perform operations on any collections it might make use of, for example adding or removing cards from the players deck.
Extension of Classes: You should create classes that extend some of the ones above where appropriate. For example, you could extend the player class to cre-ate classes specifically for a human player or different types of computer players.
Game Class: You should create a class that initializes the game and contains all of the logic for the game itself.
Main Class: You should have a Main Class with a Main Method that will instanti-ate the game. It is good practice to have nothing else present here as it allows you to create attributes and functions that are not static and therefore allow for the correct use of multiple instances.
You could use:
Document your Java Implementation (Needed for a pass):
Each class, method, field and constructor in your Java implementation should have a javadoc comment, even if its scope is private. You could use @param and @return tags where appropriate.