I'm developing a card game that requires one deck of 52 cards using Java. The 52 card has 4 suits from top to bottom: diamonds (d), clubs (c), hearts (h), and spades (s). Each card has a point. The rest of the instructions are in the images. You may add classes to support inheritance, association, aggregation, composition, or any significant features. I just need help to program the sorting of the 5 cards at a player, and the calculation of highest points. The rest of the coding is not needed.

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter7: Developing An Excel Application
Section: Chapter Questions
Problem 3.10CP
icon
Related questions
Question
100%

I'm developing a card game that requires one deck of 52 cards using Java.

The 52 card has 4 suits from top to bottom: diamonds (d), clubs (c), hearts (h), and spades (s). Each card has a point. The rest of the instructions are in the images.

You may add classes to support inheritance, association, aggregation, composition, or any significant features.

I just need help to program the sorting of the 5 cards at a player, and the calculation of highest points. The rest of the coding is not needed.

* 2-Player Phase *
Baba
= 33
***********
Cindy = 74
Available Cards:
Available Cards:
Baba : CA c7 d7 d8 d9, cK c3 dA c6 d4, c4 s3 hA hX dK, dQ
Cindy: h3 d5 d3 so c9, d2 s8 h8 s9 cọ, cJ h2 s2 s6 sX, sK
Page 3 of 7
Press ENTER to next round.
*** ROUND 3 ***
Cards at Hand:
Baba : CA c7 d7 d8 d9 | Point = 24 | Win
Cindy: c9 d3 d5 h3 sQ | Point = 10
Score:
Baba : họ dx h7 c2 cX, h4 d6 c5 s5 h9, CA c7 d7 d8 d9, cK c3 dA c6 d4,
= 57
Cindy = 74
Baba
c4 s3 hA hx dK, dQ
Cindy: h6 hJ c8 sJ hk, s4 h5 dJ s7 sSA, h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ,
c) h2 s2 s6 sx, sK
Available Cards:
Baba : cK c3 dA có d4, c4 s3 hA hx dK, do
Cindy: d2 s8 h8 s9 cQ, cJ h2 s2 s6 sX, sK
Press S to Shuffle or ENTER to start.
Press ENTER to next round.
*** ROUND 1 ***
Cards at Hand:
Page 4 of 7
Baba : c2 cX dX h7 hQ | Point = 17
Cindy: c8 h6 hJ hk sJ
Point = 26 | win
Score:
Baba
= 20
Cindy = 74
Available Cards:
Baba : h4 d6 c5 s5 h9, CA c7 d7 d8 d9, ck c3 dA C6 d4, c4 s3 hA hX dK, dQ
Cindy: s4 h5 dJ s7 sA, h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ, c) h2 s2 s6 sx, sK
Press ENTER to next round.
*** ROUND 4 ***
Cards at Hand:
Baba : c3 c6 ck dA d4 | Point = 19 | Win
Cindy: cQ d2 h8 s8 s9 | Point = 17
*** ROUND 2 ***
Cards at Hand:
Baba : c5 d6 h4 h9 s5 | Point = 13 | Win
Cindy: dJ h5 SA s4 s7 | Point = 12
Score:
Baba
= 76
Score:
Cindy - 74
Baba
= 33
Cindy - 74
Available Cards:
Baba : c4 s3 hA hx dK, dọ
Cindy: cJ h2 s2 s6 sX, sk
Available Cards:
Baba : CA c7 d7 d8 d9, cK
Cindy: h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ, cJ h2 s2 s6 sX, sK
c3
dA c6 d4, c4 s3 hA hX dK, dQ
***** Baba is the WINNER! *****
Transcribed Image Text:* 2-Player Phase * Baba = 33 *********** Cindy = 74 Available Cards: Available Cards: Baba : CA c7 d7 d8 d9, cK c3 dA c6 d4, c4 s3 hA hX dK, dQ Cindy: h3 d5 d3 so c9, d2 s8 h8 s9 cọ, cJ h2 s2 s6 sX, sK Page 3 of 7 Press ENTER to next round. *** ROUND 3 *** Cards at Hand: Baba : CA c7 d7 d8 d9 | Point = 24 | Win Cindy: c9 d3 d5 h3 sQ | Point = 10 Score: Baba : họ dx h7 c2 cX, h4 d6 c5 s5 h9, CA c7 d7 d8 d9, cK c3 dA c6 d4, = 57 Cindy = 74 Baba c4 s3 hA hx dK, dQ Cindy: h6 hJ c8 sJ hk, s4 h5 dJ s7 sSA, h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ, c) h2 s2 s6 sx, sK Available Cards: Baba : cK c3 dA có d4, c4 s3 hA hx dK, do Cindy: d2 s8 h8 s9 cQ, cJ h2 s2 s6 sX, sK Press S to Shuffle or ENTER to start. Press ENTER to next round. *** ROUND 1 *** Cards at Hand: Page 4 of 7 Baba : c2 cX dX h7 hQ | Point = 17 Cindy: c8 h6 hJ hk sJ Point = 26 | win Score: Baba = 20 Cindy = 74 Available Cards: Baba : h4 d6 c5 s5 h9, CA c7 d7 d8 d9, ck c3 dA C6 d4, c4 s3 hA hX dK, dQ Cindy: s4 h5 dJ s7 sA, h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ, c) h2 s2 s6 sx, sK Press ENTER to next round. *** ROUND 4 *** Cards at Hand: Baba : c3 c6 ck dA d4 | Point = 19 | Win Cindy: cQ d2 h8 s8 s9 | Point = 17 *** ROUND 2 *** Cards at Hand: Baba : c5 d6 h4 h9 s5 | Point = 13 | Win Cindy: dJ h5 SA s4 s7 | Point = 12 Score: Baba = 76 Score: Cindy - 74 Baba = 33 Cindy - 74 Available Cards: Baba : c4 s3 hA hx dK, dọ Cindy: cJ h2 s2 s6 sX, sk Available Cards: Baba : CA c7 d7 d8 d9, cK Cindy: h3 d5 d3 sQ c9, d2 s8 h8 s9 cQ, cJ h2 s2 s6 sX, sK c3 dA c6 d4, c4 s3 hA hX dK, dQ ***** Baba is the WINNER! *****
Face
Point
Score:
Ali
= 0
= 0
Ace/A
1
Baba
2-9
Follow the face
Cindy = 29
10/X
10
Jack/J
Queen/Q 10
King/K
10
Available Cards:
: h5 h3 dJ d8 s7, cX c2 h4 hA d2, hJ hX s2
Ali
Baba : d5 s3 d3 h2 h8, c9 hk d6 s) sX, s8 d7
Cindy: c8 h9 hQ sQ cJ, dK c6 s9 s4 c7, s5 c3
10
2.1 Game Rules
Press ENTER to next round.
1. The game has two (2) phases: 3 Players, and 2 Players.
2. The game begins with the 3 Players phase. Three (3) rounds are played in the 3 Players phase.
The top 2 players with the highest score proceed to the 2 Players phase. Four (4) rounds are
played in the 2 Players phase.
3. At the end of the 2 Players phase, the player with the highest score wins the game.
*** ROUND 2 ***
Cards at Hand:
Ali : d8 dJ h3 h5 s7| Point = 18
Baba : d3 d5 h2 h8 s3 | Point = 10
Cindy: c8 cJ h9 hQ sQ | Point = 19 | win
4. The 52 cards are shuffled and can be re-shuffled at the beginning of each phase in the game.
5. In each round, players are each dealt 5 cards. As shown in the sample run, Ali receives the 5
cards in the following order
Ali: c5 s6 sk dA CK
Score:
Ali
Baba
The program shall sort the cards by suit then face.
Ali: c5 cK dA s6 sK
6. In each round, the player with the highest point wins that round. If there is a tie, both players
Cindy = 48
win.
Available Cards:
: CX c2 h4 hA d2, hJ hx s2
Baba : c9 hK d6 sJ sX, s8 d7
Cindy: dK c6 s9 s4 c7, s5 c3
Ali
7. The point is chosen from the suit that gives the highest point (study the sample run).
8. At the end of the game, the player with the highest score is declared the winner.
2.2 Sample run
To make testing easier and save time during interview, your program shall never clear screen.
*** ROUND 3 ***
Cards at Hand:
: c2 cX d2 hA h4 | Point = 12
Ali
Baba : c9 d6 hk sX sJ | Point = 20 | win
Cindy: c6 c7 dK s4 s9 | Point = 13
* 3-Player Phase *
****
Enter player 1 name: Ali
Enter player 2 name: Baba
Enter player 3 name: Cindy
Score:
Ali
Baba
= 20
Available Cards:
Cindy = 48
: c5 s6 sk dA CK, h5 h3 dJ d8 s7, cXx c2 h4 hA d2, hJ hx s2
Ali
Baba : d4 h7 c4 cQ SA, d5 s3 d3 h2 h8, c9 hk d6 sJ sx, s8 d7
Cindy: CA dx h6 dQ d9, c8 h9 hQ sQ cJ, dK c6 s9 s4 c7, s5 c3
Available Cards:
Ali
: hJ hX s2
Baba : s8 d7
Cindy: s5 c3
Press S to Shuffle or ENTER to start.
<Enter is pressed>
***** Baba and Cindy proceed to 2-Player phase *****
*** ROUND 1 ***
Cards at Hand:
Ali : c5 ck dA s6 sK | Point = 16
Baba : c4 cQ d4 h7 SA| Point = 14
Cindy: CA d9 dX dQ h6
*****
* 2-Player Phase *
******************
Point = 29 | win
Transcribed Image Text:Face Point Score: Ali = 0 = 0 Ace/A 1 Baba 2-9 Follow the face Cindy = 29 10/X 10 Jack/J Queen/Q 10 King/K 10 Available Cards: : h5 h3 dJ d8 s7, cX c2 h4 hA d2, hJ hX s2 Ali Baba : d5 s3 d3 h2 h8, c9 hk d6 s) sX, s8 d7 Cindy: c8 h9 hQ sQ cJ, dK c6 s9 s4 c7, s5 c3 10 2.1 Game Rules Press ENTER to next round. 1. The game has two (2) phases: 3 Players, and 2 Players. 2. The game begins with the 3 Players phase. Three (3) rounds are played in the 3 Players phase. The top 2 players with the highest score proceed to the 2 Players phase. Four (4) rounds are played in the 2 Players phase. 3. At the end of the 2 Players phase, the player with the highest score wins the game. *** ROUND 2 *** Cards at Hand: Ali : d8 dJ h3 h5 s7| Point = 18 Baba : d3 d5 h2 h8 s3 | Point = 10 Cindy: c8 cJ h9 hQ sQ | Point = 19 | win 4. The 52 cards are shuffled and can be re-shuffled at the beginning of each phase in the game. 5. In each round, players are each dealt 5 cards. As shown in the sample run, Ali receives the 5 cards in the following order Ali: c5 s6 sk dA CK Score: Ali Baba The program shall sort the cards by suit then face. Ali: c5 cK dA s6 sK 6. In each round, the player with the highest point wins that round. If there is a tie, both players Cindy = 48 win. Available Cards: : CX c2 h4 hA d2, hJ hx s2 Baba : c9 hK d6 sJ sX, s8 d7 Cindy: dK c6 s9 s4 c7, s5 c3 Ali 7. The point is chosen from the suit that gives the highest point (study the sample run). 8. At the end of the game, the player with the highest score is declared the winner. 2.2 Sample run To make testing easier and save time during interview, your program shall never clear screen. *** ROUND 3 *** Cards at Hand: : c2 cX d2 hA h4 | Point = 12 Ali Baba : c9 d6 hk sX sJ | Point = 20 | win Cindy: c6 c7 dK s4 s9 | Point = 13 * 3-Player Phase * **** Enter player 1 name: Ali Enter player 2 name: Baba Enter player 3 name: Cindy Score: Ali Baba = 20 Available Cards: Cindy = 48 : c5 s6 sk dA CK, h5 h3 dJ d8 s7, cXx c2 h4 hA d2, hJ hx s2 Ali Baba : d4 h7 c4 cQ SA, d5 s3 d3 h2 h8, c9 hk d6 sJ sx, s8 d7 Cindy: CA dx h6 dQ d9, c8 h9 hQ sQ cJ, dK c6 s9 s4 c7, s5 c3 Available Cards: Ali : hJ hX s2 Baba : s8 d7 Cindy: s5 c3 Press S to Shuffle or ENTER to start. <Enter is pressed> ***** Baba and Cindy proceed to 2-Player phase ***** *** ROUND 1 *** Cards at Hand: Ali : c5 ck dA s6 sK | Point = 16 Baba : c4 cQ d4 h7 SA| Point = 14 Cindy: CA d9 dX dQ h6 ***** * 2-Player Phase * ****************** Point = 29 | win
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L