Question
Create a class and a client program that simulates a slot machine. The program runs it should do the following: Ask the user to enter
Create a class and a client program that simulates a slot machine.
The program runs it should do the following:
Ask the user to enter the amount of money he or she wants to enter into the slot machine and check the value if it is between 1 dollar and 100 dollars inclusive.
This program will not show images. Instead have the program display a word from the following list:
Cherries, Oranges, Plums, Bells
To select a word, the program will generate a random number in the range of 0 through 3. Have each number correspond to a word. For example 0 = Cherries, 1 = Oranges and etc.
There are three wheels on the slot machine so the program should randomly generate a number three times, one for each wheel, during a play. The three words should then be displayed.
If none of the randomly selected words match, the program should inform the user that they won $0. If two of the words match, the program should inform the user that they won two times the amount they entered. If three of the words match, the program should inform the user that they won three times the amount entered. The program should print out the original amount entered, the amount won, if any, and the running total of the total winnings or losses.
The program should ask the user if they want to spin the slot again. If the user wants to play again the steps should be repeated until the user decides not to play any,ore games. When user does not want to play any more the program should display the total amount entered into the slot machine, the total amount won, and the actual winnings or losses of the user.
The class should have methods to generate the images, to compare the images, and to tell the user how much they won. The images are not actual images, but are the strings
The class should be named SlotMachine. The client program should be named SlotGame. There should only be one default constructor for the SlotMachine class.
Do not use arrays in the class or program this is a java program
Only use java.util.*
the SlotMachine class should include the default constructors, getters, setters, and methods. The slotsgame should utilize the SloMachine class.
try to do most of the calculation in the class as methods
Step 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