Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A. This project will have two different classes a. Main b. Slot Machine B. Main class a. The Main class will have the following class
A. This project will have two different classes a. Main b. Slot Machine B. Main class a. The Main class will have the following class variables i. Money (Initially set to 100) ii. An array of slot machine instances b. The main constructor will dynamically add a section tag to the document i. This will be used to print the output C. The main constructor will also initialize the slot machine array with 1 instance of the slot machine. d. The main class will also have a function called PlayAll e. If the 'play button is pressed, then subtract 1 from the current value of Money (make sure it is above 0) and then iterate through the slot machine array and call their respective play function. f. It will then poll all the slot machines and sum the last amount won. i. Ifis>than 0 then have the word "winner and the summed amount won displayed in the section that the main class created ii. Else display "Game Over" g. Add any winnings to the total money. C. Slot Machine Class a. This class will have the following class variables i. The last amount won ii. A list of three numbers iii. A list of three HTML image objects b. Constructor i. The slot machine constructor will dynamically add three HTML images to the document and then store them to the image list. 1. Each Image will be 64x64 pixels). ii. The last amount won will be initialized to 0. C. Play i. When play is called the slot machine will pick three numbers and populate the number list. 1. The slot machine will randomly choose between 0 and 6 inclusive. ii. Make sure you have seven images 1. Each image will correspond to a certain number between 0 and 6. iii. Change the HTML image src parameter to the correct image for the appropriate number 1. For example, if the number list contains [5.5.4] 2. The first two images will be the same that correspond to 5) 3. The third image will have the src set to the appropriate image for 4. iv. Slot machine awards are evaluated left to right. Therefore, ORDER DOES Matter. V. Also, you can ONLY win the top award in a slot machine. 1. For example if you get three O's you do NOT get the two 0's or one o's award. vi. The play function will set the last amount won according to the following table: D. After the script that initializes main is run create an HTML button that will call back to a global function which will call the main instance PlayAll a. This button should be labeled "play" E. Phase 2 a. Alter the constructor in Main so you make 3 slot machine instances instead of just 1 b. If you coded the main class correctly you should not have to change anything in it. Amount Won 14 7 Description Three O's Three of any other number (not 0) Two O's (left and center) Two of any other number in the left and the center If the left value is 0 Any other combination Values in the number array [0.0.0] [X.X.X] Where X is the same non-zero number [0.0.X] Where X is not a 0. [X.X-] Where X is the same non-zero number [0:-:-) 3 2 1 0
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