Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an application that simulates a slot machine. The player starts out with M coins. The value of M is an input to the

 

Write an application that simulates a slot machine. The player starts out with M coins. The value of 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 these: No. Combinations Payoff (times betting amount) 1 BELL BELL BELL 10 2 GRAPES GRAPES GRAPES 7 3 CHERRY CHERRY CHERRY 5 4 CHERRY CHERRY 3 5 CHERRY CHERRY 3 6 CHERRY CHERRY 3 7 CHERRY 1 8 CHERRY 1 CHERRY 1 9 The symbol means any piece. If the player bets 4 coins and gets combination 5, for example, the machine pays the player 12 coins.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions