Question: ava Using the following UML, create a class called Card, which represents single object in a pack of playing cards. It holds a value 1-13

ava Using the following UML, create a class called Card, which represents single object in a pack of playing cards. It holds a value 1-13 inclusive, which represents (Ace, 2, 3, .. , Jack, Queen, King) and a suit 1-4 inclusive (Spades, Clubs, Diamonds, Hearts) which is given when a Card is constructed (ensure that these values can't be set with invalid numbers). It has suitable "getter" methods which retrieve this information and a toString method (feel free to also use private helper methods), which converts the value and suit to a suitable output String (eg: if value-1, suit-2 then toString will return [AC] if value 4, suit 4 toString returns [4H], if value-12, suit-1 then toString returns [Qs]) Card Deck - suit: int - value int - dec k : Cardl - deckSize: int MAX_SIZE 52: int +Deck() +Deck(fullDeck:boolean) initialiseFullDeck): void +drawCard) Card +placeCard(card : Card): void 0...52 +Card(value: int, suit: int) +getValue(): int +getSuit(): int +toString(): String 1+shuffle() void +getDeckSize() : int hasCardsRemaining(): boolean +toString() : String > Comparable
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
