Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Javascript Question 1) : Slot Machine SlotMachine - generator : Random - tokenCredit int Using the following UML, create a class called SlotMachine that simulates

image text in transcribed

Javascript Question 1) : Slot Machine SlotMachine - generator : Random - tokenCredit int Using the following UML, create a class called SlotMachine that simulates a casino slot machine in whichthree numbers between 0 and 9 are randomly selected and+topupTokens(tokens:int): void printed side by side. This is done using the "pullLever"+cashoutTokens() : int method which is overloaded, a default method which uses+pullLever(): void one token, and a parameter method which can specify+pull ever(tokenlnput:int) : void how many tokens to gamble for that single pull. There are getTokenBalance():int five situations which occur when the lever is pulled +mainlargs:String[l) void 1) (0,0,0) Super Jackpot, all zeros. Token input is multiplied by a factor of 500 and added to the machine token credit. Should output suitable "Super Jackpot Winner" message showing winnings 2) X,X,X) Three number win. Where X is a value 1-9, token input is multiplied by a factor of 50 and added to the machine token credit. Should output suitable "Jackpot Winner" message showing winnings 3) X,X,Z) Free spin. Where X and Z are values 0-9 and Z#X, token input is added back into the 4) {X,Y,Z} Bad luck, where X,Y,Z are values 0-9 and ZsytX, token input subtracted from machine 5) Insufficient Token Balance, where there is not enough tokens in machine to pullLever using machine token credit. Should output suitable "Free Spin" message token credit. Should output suitable "Bad Luck, Try again" message the token input amount A user can also top up their machine token credit, and cashout tokens. Add a suitable main method which tests the class. It should use Scanner to repeatedly allow user to input tokens, and pull lever using the desired amount of tokens they wish gamble with. The user can exit the machine and cash out" once they have done playing. Use suitable output to show user what is happening in the class and repeatedly show the current machine token balance Add another variable called houseCredit, which is used to keep track of the total amount of tokens inserted across all instances of SlotMachine, add another method called getHouseCredit, which can be used to obtain this information. Show the changes in main in a suitable way, a user should be able to jump across different slot machines, until they choose to leave the casino

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

5. If yes, then why?

Answered: 1 week ago

Question

3. What changes should I be making?

Answered: 1 week ago