Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

DiceSimulator + runSimulation(int numberRolls):DiceAccumulator DiceSimulator - C

ID: 3759849 • Letter: D

Question

DiceSimulator + runSimulation(int numberRolls):DiceAccumulator DiceSimulator - Controls the running of the dice simulation. • runSimulation – Does the simulation of throwing two die. Determines how many times they both have the same number and accumulates the totals. Pseudocode : Dice Simulator runSimulation Algorithm CREATE DiceAccumulator object CREATE two Die objects REPEAT the number of times indicated by the numberRolls value passed into the method. Roll the first die Roll the second die IF spots on each die are the same IF spots = 1 CALL addSnakeEyes ELSE IF spots = 2 CALL addTwos ELSE IF spots = 3 CALL addThrees ELSE IF spots = 4 CALL addFours ELSE IF spots = 5 CALL addFives ELSE CALL addSixes END ELSE IF END IF END

Explanation / Answer

DiceSimulator + runSimulation(int numberRolls):

DiceAccumulator DiceSimulator - Controls the running of the dice simulation. • runSimulation – Does the simulation of throwing two die. Determines how many times they both have the same number and accumulates the totals. Pseudocode : Dice Simulator runSimulation Algorithm CREATE DiceAccumulator object CREATE two Die objects REPEAT the number of times indicated by the numberRolls value passed into the method. Roll the first die Roll the second die IF spots on each die are the same IF spots = 1 CALL addSnakeEyes ELSE IF spots = 2 CALL addTwos ELSE IF spots = 3 CALL addThrees ELSE IF spots = 4 CALL addFours ELSE IF spots = 5 CALL addFives ELSE CALL addSixes END ELSE IF END IF END

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote