Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

TCSS 142 Introduction to Programming Winter 2020 Assignment #4 Due 11 February 2020 Value: 5% of the course grade Write an interactive program named Slot

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

TCSS 142 Introduction to Programming Winter 2020 Assignment #4 Due 11 February 2020 Value: 5% of the course grade Write an interactive program named Slot Machine.java that simulates a slot machine. A slot machine is a gambling device that a user inserts money into 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 machine dispenses to the user. When your simulation (program) runs it should do the following: Display an introduction. Ask the user how much money they currently have for the game. Valid values are between $0.25 and $20.00 If the user enters an invalid response to the prompt, the program should display an appropriate message and prompt again repeatedly until a valid response is provided. In these instructions, I call the amount the user enters initial total Your program should then perform the following steps repeatedly until the user chooses to quit: Asks the user to choose the amount of money to enter into the slot machine. (Valid choices are 1 = $0.25, 2 = $0.50, 3 = $1.00.4="quit the program". The amount selected is the user's bet). The user cannot bet more money than their current total. If the user enters an invalid choice, prompt repeatedly until a valid choice is entered. Instead of displaying images, have the program randomly select a word from the following list: Cherries, Oranges, Plums, Bells, Melons, Bars To select a word, the program will generate a random number in the range 0 to 5. If the number is 0, the selected word is Cherries, if the number is 1, the selected word is Oranges, and so forth. The program should randomly select a word from this list three times and display all three words. If none of the randomly selected words match, the program informs the user that they lost the amount of their bet. Subtract the amount of the user's bet from the user's current total. If exactly two of the words match, inform the user that they won two times the amount of their bet. Add two times the amount of the user's bet to the user's current total. If all three of the words match, inform the user that they won three times the amount of their bet. Add three times the amount of the user's bet to the user's current total. Display the user's current total. Ask the user if they want to play again. The game should repeat until the user chooses to quit or has

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_2

Step: 3

blur-text-image_3

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students explore these related Databases questions