Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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. 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. 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 52card 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. Provided code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started