Problem

Write a graphical user interface for the slot machine program in Exercise 31 on page 362...

Write a graphical user interface for the slot machine program in Exercise 31 on page 362. Use three JLabel objects for displaying bells, grapes, and cherries. Add a button that simulates the motion of pulling down the handle.

Reference Exercise 31 on page 362.

Write an application that simulates a slot machine. The player starts out with M coins. The value for M is an input to the program, and you charge 25 cents per coin. For each play, the player can bet 1 to 4 coins. If the player enters 0 as the number of coins to bet, then the program stops playing. At the end of the game, the program displays the number of coins left and how much the player won or lost in the dollar amount. There are three slots on the machine, and each slot will display one of the three possible pieces: BELL, GRAPE and CHERRY. When certain combinations appear on the slots, the machine will pay the player. The payoff combinations are as follows:

The symbol ----------- means any piece. If the player bets 4 coins and get combination 5, for example, the machine pays the player 12 coins.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 14