When you pick four cards from a deck of 52 cards for the 24-point game introduced in

Question:

When you pick four cards from a deck of 52 cards for the 24-point game introduced in Programming Exercise 20.13, the four cards may not have a 24-point solution. What is the number of all possible picks of four cards from 52 cards? Among all possible picks, how many of them have 24-point solutions? What is the success ratio?that is, (number of picks with solutions)/ (number of all possible picks of four cards)?

Write a program to find these answers.

The 24-point game is to pick any 4 cards from 52 cards, as shown in Figure

image

King, Queen, and Jack represent 1, 13, 12, and 11, respectively. You can click the Shufflebutton to get four new cards. Enter an expression that uses the four numbers from the four selected cards. Each number must be used once and only once. You can use the operators (addition, subtraction, multiplication, and division) and parentheses in the expression. The expression must evaluate to 24. After entering the expression, click the Verifybutton to check whether the numbers in the expression are currently selected and whether the result of the expression is correct. Display the verification in a label before the Shufflebutton. Assume that images are stored in files named 1.png, 2.png, . . . , 52.png, in the order of spades, hearts, diamonds, and clubs. So, the first 13 images are for spades 1, 2, 3, . . . , and 13.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: