[SOLVED] game Java software COMP517 Assignment 6

$25

File Name: game_Java_software_COMP517_Assignment_6.zip
File Size: 367.38 KB

5/5 - (1 vote)

COMP517 Assignment 6
(Does not contribute to final mark)
In the multiplayer version of our game, each user can call upon one or more dragons under their
control. There are three types of dragon red, blue and green and each has a firepower value in
the range 5-10. To distribute the dragons among the players, we will use a set of simulated set of
dragon cards. There are 18 dragon cards in total, and no two cards are the same; i.e. each of the
dragon colours is associated with each of the possible firepower values exactly once.
Begin by writing a Java class to represent a dragon card. Internally, a card has instance variables
representing its colour and firepower. The class must also have a toString() method that returns a
String representation of the card (e.g. RED 5, GREEN 9, etc.)
Next, write a class to represent the full set of dragon cards. The cards should initially be created in a
pre-defined order. Implement a shuffle() method to put the cards into a random order. Also
implement a show() method to list all the cards in the set. You should call this method both before
and after shuffling.
Finally, implement two Player objects. Your program should ensure that each player requests a card
from the deck in turn until all cards have been dealt. The players should then display the hands they
hold.
SAMPLE RUN
Creating dragon cards
The cards are:RED 5
RED 6
RED 7

RED 10BLUE 5BLUE 6 GREEN 10
Shuffling cards
The cards are:GREEN 7
RED 9
BLUE 10GREEN 6
BLUE 6
BLUE 8

Dealing cards
The hands are:
PLAYER 1=======GREEN 7 BLUE 10
etc.
NOTES
This assignment does not count towards the final module mark. However, use it to think about some
of the software design issues discussed in lectures.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] game Java software COMP517 Assignment 6
$25