For this assignment you will have to investigate the use of theJava random numbe
ID: 3608970 • Letter: F
Question
For this assignment you will have to investigate the use of theJava random number generator function,Math.random(). You can find this in the textor using the online resources given in the lectures.
The program will loop, asking the user for a bet amount from 0to 100 (assume dollars, you can use ints orlongs). If the user types a 0 that meanshe/she wants to quit. Otherwise, accept the amount as theirbet and simulate a slot machinepull. Your program will print out a line thatlooks like a slot machine result containing three Strings. Some examples are: BAR 7 BAR, 7 7 cherries, cherries BAR space, space BAR BAR, or cherries cherries BAR.
You will have to use methods as follows to get credit for thisassignment:
Communicate all values as parameters or return values, notthrough globals.
Position counts! If you read the above bulletthat contains the warning "ORDER MATTERS", you will see thatcherries bar cherries pays 3x while cherries cherriesbar pays 10x and bar cherries cherriespays nothing.
Explanation / Answer
please rate - message me if needs anytweaking, or if there is anything you don't understand - thanks import java.util.*; public class slots { public static void main(String[]args) {Scanner in = newScanner(System.in); String s1,s2,s3; int bet,i,payMultiplier; bet=GetBet(in); while(bet>0) {s1=Pullone(); s2=Pullone(); s3=Pullone(); for(i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.