Extra Credit Assignment 2: Slot Machine in Java with full source code


Problem Introduction:

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:
The symbol --------- means any piece. If the player bets 4 coins and gets combination 5, for example, the machine pays the player 12 coins.

Code Screenshot:


Get Project Solution Now

Comments