https://docs.google.com/document/d/1MAk-kTRo5wLQl4bdupflF1YiyIr8k0w…
Question Answered step-by-step https://docs.google.com/document/d/1MAk-kTRo5wLQl4bdupflF1YiyIr8k0w… https://docs.google.com/document/d/1MAk-kTRo5wLQl4bdupflF1YiyIr8k0wr4SpBI0BtOLQ/edit?usp=sharing. The code for the question below can be accessed through this link. Can you please error trap unwanted input and Error-handle any exceptions that may arise with try-catch statements. If there is room for efficiency than you can make it efficient. A slot machine is a gambling device that the 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 slot machine dispenses back to the user.Help coding a program that simulates a slot machine (except the user does not need to spend money). When the program runs, it should do the following:When you start the program, you must ask the user if they want to play the slot machine, access the high score, or quit If they choose to play the slot machine:You must ask the user which file they would like to open. They will want to open a filed named reels.txt. You must make sure this file exists.Simulate the slot machine. Instead of displaying images, the program will randomly select a word from a list. This list will be held in the pre-existing text file called reels.txt. The file will contain the following single line of text.Cherries, Oranges, Plums, Bells, Melons, Bars Using the Random object, select a random word from this list 3 times, printing out the chosen words to the screen.If none of the randomly selected words match, the program will inform the user that he or she has not won anything. If two of the words match, the program will inform the user that he or she has won $10. If three of the words match, the program will inform the user that he or she has won $30.The program will ask whether the user wants to play again.If so, these steps are repeated and the total amount money won will be kept track of. If not, the program displays the total amount of money won.When the game ends, the program will ask for the users name. Store their name and amount of money won in a different text file called SlotScores.txt which you can append data to.As soon as the game ends, they should AUTOMATICALLY be brought back to the main menu with the 3 options. If they choose to view the high scoresYou will open and print out the contents of SlotScores.txtAs soon as this is finished printing on the screen, they should AUTOMATICALLY be brought back to the main menu with the 3 options. If they choose to quitPrint out a friendly goodbye message and end the programDo NOT use System.exit(0) to accomplish this! NOTES:You are given two text files for this assignment: reels.txt and SlotScores.txtFor full marks, ensure to include thorough commenting throughout your program.Error-trap for any unwanted inputError-handle any exceptions that may arise with try-catch statementsYou will be marked on your program’s efficiency Computer Science Engineering & Technology Java Programming SCIENCE ICS4U Share QuestionEmailCopy link Comments (0)


