Question: JavaScript 9x currentBet f. [4 marks] Function calculatePayout(). No parameters. Returns payout. Use the contents of currentslot1, currentslot2, and currentsiot3 to calculate (see Table 1)

JavaScript

JavaScript 9x currentBet f. [4 marks] Function calculatePayout(). No parameters. Returns payout.

9x currentBet f. [4 marks] Function calculatePayout(). No parameters. Returns payout. Use the contents of currentslot1, currentslot2, and currentsiot3 to calculate (see Table 1) and return the payout: Play Outcome: Payout: Triple Seven 30 x currentBet Triple of any other image (see Figure 2) Double Cherry (2 out of 3 images are a 3 x currentBet Cherry) Anything else Note: Refer to function updateslotImage() to see the mapping of numeric values (held in currentslot1, currentslot2, and currentslot3) to images. The updateslotImage() function is provided for you. Do not modify. Table 1 0 g. [3 marks] Function rollOneSlot( slotImageID ). Returns newRoll. Generate and return newRoll, a random integer number from 1 to 5 inclusive. Update the slot image using newRoll and the slot identified by slotimagel (refer to updateslotImage()). h. [2 marks] Function rollslots(). No parameters. Update each of currentSlot1, currentslota, and currentSlot3 by invoking rollOneSlot( slotImageID) with the appropriate argument for slotImageID. i. (6 marks] Function scheduleOnePlay(). No parameters. This function does one play of the slot machine as follows: i. Disable all three buttons ("Place Bet of 1 Credit, Place Bet of 3 Credits, and Play Me Now!"). Reset the hWinner heading to display nothing. See update Winner(). Deduct the currentBet from the currentCredits, and update the play statistics (refer to updatePlayStats(). Schedule the function rollslots() to run every 50 ms. At 2 seconds in the future, schedule the function tallyOnePlay( (which stops rollslots() from running, see tallyOnePlay(), below). ii. iv. 9x currentBet f. [4 marks] Function calculatePayout(). No parameters. Returns payout. Use the contents of currentslot1, currentslot2, and currentsiot3 to calculate (see Table 1) and return the payout: Play Outcome: Payout: Triple Seven 30 x currentBet Triple of any other image (see Figure 2) Double Cherry (2 out of 3 images are a 3 x currentBet Cherry) Anything else Note: Refer to function updateslotImage() to see the mapping of numeric values (held in currentslot1, currentslot2, and currentslot3) to images. The updateslotImage() function is provided for you. Do not modify. Table 1 0 g. [3 marks] Function rollOneSlot( slotImageID ). Returns newRoll. Generate and return newRoll, a random integer number from 1 to 5 inclusive. Update the slot image using newRoll and the slot identified by slotimagel (refer to updateslotImage()). h. [2 marks] Function rollslots(). No parameters. Update each of currentSlot1, currentslota, and currentSlot3 by invoking rollOneSlot( slotImageID) with the appropriate argument for slotImageID. i. (6 marks] Function scheduleOnePlay(). No parameters. This function does one play of the slot machine as follows: i. Disable all three buttons ("Place Bet of 1 Credit, Place Bet of 3 Credits, and Play Me Now!"). Reset the hWinner heading to display nothing. See update Winner(). Deduct the currentBet from the currentCredits, and update the play statistics (refer to updatePlayStats(). Schedule the function rollslots() to run every 50 ms. At 2 seconds in the future, schedule the function tallyOnePlay( (which stops rollslots() from running, see tallyOnePlay(), below). ii. iv

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!