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.

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

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!