TaskYou will implement a Java program that encodes the Three Card Poker rules and, given threecards, it can tell what rank they are. Three Card Poker is similar to the traditional poker but...

1 answer below »
Simple assignment, instructions are to use if else statements


Task You will implement a Java program that encodes the Three Card Poker rules and, given three cards, it can tell what rank they are. Three Card Poker is similar to the traditional poker but it's played with 3 instead of 5 cards, which makes it simpler as it has fewer hands to consider. All you need to know is that the game has the following six hands in descending order. No other knowledge is assumed or needed to do this assignment. Rank Description Example Output aaa Straight flush ~~ Three suited cards in sequence i ue oe 10 2 #Yes| vw ih M0 ove Three of a kind Three cards of same rank She eV 8 * ve NAAN a 6 0 hh Straight Three cards in sequence $03 0, a» a 7 VC Ve ee SW [ha in a » Flush Three suited cards a : : ob 5 @ | 9¥e: . 5] 0 Vv v3 ie [Fe [8 Pair Two cards of same rank 2 3 | at 8 A 1 v + wy High card None of the above Vv 8 orl 1 of | a%as Table 1 Since we haven't discussed the complete topic of Input/Output yet, and to avoid any errors due to misspelling and capitalization, your program will not read or print anything. All your code must be placed inside a method named calculate that accepts three parameters, one for each card, and returns a single number. A complete template for your code is provided at the end of this document. 3 The number returned from calculate is one of the values provided in the column “output” of Table 1. Think of it as the score of a certain hand. The three input parameters of calculate represent the three cards of the hand. Each card is encoded with a positive integer. We will use the Table 2 mapping to represent the standard 52- card deck with integers. Invalid inputs: If calculate is provided with syntactically correct but logically incorrect values (e.g. -1, 55, 1000, etc.), the method must return the value of zero. Assumptions: + The three parameters are guaranteed to be distinct. You don't have to validate this. + If a hand satisfies more than one rank (e.g. a Straight flush is also a Flush), we select the higher one (e.g. Straight Flush). + To simplify things, the Ace will always rank low (i.e. 1). This means that a hand like “Queen, King, Ace” is not a straight. Ace 2 3 4 5) 6 7 8 9 10 Jack Queen King : ia [a |[aa]faa|[aa|fas|[fas]faafaa|ra|f =] [f= C) Clubs | oe » a [aa a®s wa EAE a g , sf] re wr] [wr ees] |e wr] | eer] [bow] | PT [Pg ¥ 1 2 3 4 5 6 7 8 9 0 0M" 12 13 + ie ie ie ¢ * |e ¢ *, io, d 3 ROA ! 9) 5 Diamonds | . NESBA IRAE RA IRR & & g 3 LE RIERA RARER ER HIE NAIE RHE 1 8 4 4 15 16 17 18 19 20 21 22 23 24 25 26 d iv iv vv [vv live Vy Hearts | @ v v [ewe 4 LE CEILI HIE IER 27 28 29 30 31 32 33 t Pe [28 [|e aie aa 0lie aliens iea Reeling lle al is . Spades | . o [|oa|[6%|laga||8e8[88(| 8 |B 2 deel eee of ee elo er] 00 [0 0] 0%) |® [0 |@ 40 4 42 43 44 45 46 47 48 49 50 51 52
Answered 3 days AfterJan 31, 2023

Answer To: TaskYou will implement a Java program that encodes the Three Card Poker rules and, given...

Vikas answered on Feb 03 2023
34 Votes
Output
This output is as expected. The first test case (Result 1) is a straight, so the output is 6
. The second test case (Result 2) is a three of a kind, so the output is 5. The third test case (Result 3) is a pair, so the output is 2. The fourth test case (Result 4) is an invalid input, so the...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here