Question: Learning Objectives. Write a multi-class program in Java according to a specification. Use a random number generator to produce random numbers in a specific range.






Learning Objectives. Write a multi-class program in Java according to a specification. Use a random number generator to produce random numbers in a specific range. Use a seed to control the sequence of random numbers for testing. Understand how class definitions implement a "separation of concerns", where each class encapsulates data and functionality for a related set of tasks. Understand how one class uses an instance of another class to execute the steps of a program Write Java code according to a defined style. . . * * * Overview. You will write a two-class Java program that implements the Game of 21. This is a fairly simple game where a player plays against a "dealer". The player will receive two and optionally three numbers. Each number is randomly generated in the range 1 to 11 inclusive (in notation: [1,11]). The player's score is the sum of these numbers. The dealer will receive two random numbers, also in [1,11]. The player wins if its score is greater than the dealer's score and is also less than or equal to 21. A tie goes to the dealer. The player may wager an amount of money before receiving each number. If the player wins, the wager is added to the player's total money. If the player loses, the wager is subtracted from the player's total money. The game is played as follows: The player starts with a total amount of money, 100.00 in this case. The dealer asks for an initial bet from the player. This is called an "ante". The amount of money the player can bet has to be less than or equal to the player's total amount of money. Then, the dealer generates a random number for the player. That is added to the player's score, which is initially zero. The dealer then generates a random number for itself and adds that to the dealer's score The player may place a bet with the same betting conditions as mentioned above. Then, the dealer generates another number for the player and for itself. Another bet may be placed by the player. The dealer then asks if the player wants one more number. If yes, the dealer generates another random number for the player
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
