Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public abstract class AbstractCard implements Comparable { /* handy arrays for ranks and suits */ /* do NOT change these */ public final static String[]

image text in transcribed

public abstract class AbstractCard implements Comparable{ /* handy arrays for ranks and suits */ /* do NOT change these */ public final static String[] RANKS = { "None", "None", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace", "Joker"}; public final static String[] SUITS = { "Diamonds", "Clubs", "Hearts", "Spades", "None"}; /** the numerical representation of the rank of the current card *

* ranks have the numerical values * 2 = 2, 3 = 3, ..., 10 = 10 * Jack = 11, Queen = 12, King = 13, Ace = 14 * Joker = 1 * @return the numerical rank of this card */ public abstract int getRank(); /** the string representation of the rank of the current card * * @return the string representation of the rank of this card * (must be a string from Card.RANKS) */ public abstract String getRankString(); /** the suit of the current card * * @return the suit of this card (must be a string from Card.SUITS) */ public abstract String getSuit(); @Override public final String toString(){ // outputs a string representation of a card object int r = getRank(); if( r >= 2 && r 1: Cards AY 30 marks] A standard deck of playing cards consists of 52 cards. Each card has a rank (2, 3,..., 9, 10, Jack, Queen. King, or Ace) and a suit (spades hearts clubs +, or diamonds ) You will create a class called Card that will simulate cards from a standard deck of cards. Your class will extend the AbstractCard class (provided) The ordering of the cards in a standard deck (as defined for this assignment) is first specified by the suit and then by rank if the suits are the same. The suits and ranks are ordered as follows: suits: The suits wil be ordered diamonds

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions