Question: * This is for CS 101 Java class. I CANNOT USE arrays. * Create a new project Lab06c. Write a Java program that simulates a

* This is for CS 101 Java class. I CANNOT USE arrays. *

* This is for CS 101 Java class. I CANNOT USE arrays.

Create a new project Lab06c. Write a Java program that simulates a die rolling game. The program inputs the total money from the user (integer). At each time, user makes a prediction of "even" or "odd" for the face value of the rolled die, and bets some money in that prediction. If the program rolls a die whose category (even or odd) is predicted by the user, he/she wins 50% of his/her bet. If the prediction is wrong, he/she loses the bet. The bet must be smaller than or equal to the current total money. If not, print "Your money is not enough!" and ask the bet from user again. The program terminates when the user enters 0 or the user does not have any more money to bet. c. Your program must include a static method that rolls the die, computes and returns the gain according to the face value of the die, given the prediction and the bet as parameters Sample run is shown below. Enter your total money: 90 Enter prediction (1 for ODD, 2 for EVEN) 2 Enter the amount of money you want to bet: 40 The value of the die is 3 Your total money is 50.0 Enter prediction (1 for ODD, 2 for EVEN):2 Enter the amount of money you want to bet: 20 The value of the die is 4 Your total money is 60.0 Enter prediction (1 for ODD, 2 for EVEN) 2 Enter the amount of money you want to bet: 30 The value of the die is 2 Your total money is 75.0 Enter prediction (1 for ODD, 2 for EVEN):0

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!