Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Please. This project will have two different classes a. Main b. Slot Machine B. Main class a. The Main class will have the

In Java Please.

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. If is > 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 0s you do NOT get the two 0s or one 0s 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.

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

Students also viewed these Databases questions

Question

Who was the first woman prime minister of india?

Answered: 1 week ago

Question

Explain the concept of going concern value in detail.

Answered: 1 week ago

Question

Define marketing.

Answered: 1 week ago

Question

What are the traditional marketing concepts? Explain.

Answered: 1 week ago