Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

25 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)

image text in transcribedimage text in transcribedimage text in transcribed

25 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 V, clubs , or diamonds) You will create a class called StandardCard that will simulate cards from a standard deck of cards. Your class will extend the Card 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 will be ordered diamonds clubs hearts f / handy arrays for ranks and suits / / do NOT change these public final static String [] RANKS"None", "Joker", "Jack", "Queen", "King", "Ace" 18 public final static String [] SUITS"Diamonds", "Clubs", "Hearts""Spades","NONE" 12 13 14 protected String rank; 15 protected String suit; 16 17 18ww Create a card with specified suit and rank 19 28 21 22/ 23public Card(String suit, String rank) * @paran suit is the suit of the card (nust be a string from Card.SUITS * @paran rank is the rank of the card (nust be a string from Card.RANKS) this.rank rank; this.suit-suit; 25 26 27 28 29 public String getRank) return this.rank;) public String getSuitf return this.suit; 31 32 33es the nunerical representation of the rank of the current card 34 35 ereturn the nunerical rank of this card 37 38 public abstract int getRankValue); 48 41 42public final String toString) 43 aoverride / outputs a string representation of a card object if( this.rank.equals (Card.RANKS[1]) return Card. RANKS [11 // Joker 45 46 47 48L return this.rank":"+this.suit; 49 - 58 Java- Unicode (UTF-8)-Windows (CRLF)-f Saved: 2019-03-02, 2:34:56 PM 1.253 / 156 / 50 100%

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

Step: 3

blur-text-image

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

Students also viewed these Databases questions