Question
A slot machine is a gambling device into which the user inserts money and then pulls a lever (or presses a button). The slot machine
A slot machine is a gambling device into which the user inserts money and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money that the slot machine dispenses back to the user. "Create a JavaFX application that simulates a slot machine" Figure 15-56 shows an example of how the GUI should look. The application should let the user enter into a TextField the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols. You will find a set of fruit symbol images in the Student Sample Programs.) The program should also display the amount that the user won for the spin, and the total amount won for all spins. The amount won for a spin is determined in the following way: If none of the randomly displayed images match, the user has won $0. if two of the images match, the user has won two times the amount entered. l If three of the mages match, the user has won three times the amount entered.
Figure 15-56 Slot Machine application Slot Machine Amount Inserted: S Amount Won This Spin: 0.00 Total Amount Won: $0.00 in Figure 15-56 Slot Machine application Slot Machine Amount Inserted: S Amount Won This Spin: 0.00 Total Amount Won: $0.00 inStep 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