Rewrite Exercise 20.17 using JSF, as shown in Figure 33.35. The program lets the user enter four

Question:

Rewrite Exercise 20.17 using JSF, as shown in Figure 33.35. The program lets the user enter four card values and finds a solution upon clicking the Find a Solution button.

This exercise is a variation of the 24-point card game described in Programming Exercise. Write a program to check whether there is a 24-point solution for the four specified numbers. The program lets the user enter four values, each between?1?and?13, as shown in Figure. The user can then click the?Solve?button to display the solution or display ?No solution? if none exist.

image

The user enters four numbers and the program finds a solution.

The 24-point game is to pick any 4 cards from 52 cards, as shown in Figure. Note that the Jokers are excluded. Each card represents a number. An Ace, King, Queen, and Jack represent?1,?13,?12, and?11, respectively. You can click the?Shuffle?button 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?Verify?button 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?Shuffle?button. 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.

image

The user enters an expression consisting of the numbers in the cards and clicks the Verify button to check the answer.

image? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

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

Step by Step Answer:

Question Posted: