Question Description
For this lab, start with the method you created for lab 12. Then:
- Instead of having the method roll two dice and returning the resulting total, have the method require that the calling program tells it how many dice to roll.
- The method will then roll however many dice it is told to roll, and returns that value instead.
- In the main program, ask the use to type in how many dice the ‘rollDice’ method should roll.
Hints:
- Because the method has no way of knowing how many dice it will roll, you will have to create a loop that goes from 0 to the number of gets passed to the method.
- Then, for each iteration of that loop, generate one random number between 1 and 6, and add it to a running total.
- So, before starting the loop, you will want to create a variable, perhaps called total, and set it to 0.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."