Question: Write a program to simulate the roll of a six-faced die. You'll need to write two programmer defined functions for this and call one function
Write a program to simulate the roll of a six-faced die. You'll need to write two programmer defined functions for this and call one function from the other. The first function (let' s call it Function A) calculates the value of the roll (1 through 6) and returns the value. You'll need to implement randomization in this function. The second function (let' s call it Function B) implements the following logic If the sum of two die rolls is greater than 9, the player wins If the sum of two die rolls is less than 5, the player loses. If the sum of two die rolls is 5, 6, 7, 8 or 9, the player gets to roll again It then returns whether the player has won or lost. You Function B must have a Boolean return type. From your main function, you need to print whether the player has won or lost
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
