Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help in java will like Program Specifications Write a program to play an automated dice game that uses two dice (GVDie class prowided). The

please help in java will like image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Program Specifications Write a program to play an automated dice game that uses two dice (GVDie class prowided). The player folis both dice and either wins one credit, loses one credit, or sets a goal for future rolls. Current round ends when player wins or loses a credit Game ends when credits are zero Note this program is designed for incremental development. Complete each step and submit for grading before starting the next step, Only a portion of tests pass after each step but confimm progress Step 0. Read starter template and do not change the provided code. Two GVDie objects are created A random seed is read from input and passed to a die. This supports automated testing and creates predictable results that would otherwise be random. Starting credins is read from input. Step 1 (3 pts). Roll both dice. Player wins one credit by rolling 7 or 11. Player losses one credir by rolling 2, 3, or 12 . Onherwise, credits do not change and the player's goal is set to the dice total. The player's goal must be repeated in Step "2 to win a credit. GVDie class includes roil0 and getValue0 methods. Output dice total and credits. Submit for grading to confirm 3 tests pass. Ex if input is Step 2 (4 pts). If player did not win or lose in step 1 ( (le a goal was set), continue rolling both dice until one of two outcomes: 1) player rolls a 7 and loses one credit or 2) player rolls the goal value and wins one credit. Current round ends: Set goal to-1 and output credits Submit for grading to confirm 5 tests pass. Ex If input is. 247 Sample output is: Dicetotal:8Dicetotal:12Dicetotal:7Credita:6 Step 3 (3 pts). Add a loop to repeat steps 1 and 2 until credits are zero. Count and output the number of rounds when game is over. Submit for grading to confirm all tests pasu Ex If input is: 434 Sample output ends with Credita: 2 Dice total: 0 bice total: 7 Credita: 1 Dice total: 5 Dica total: 6 Dice total: 6 Dice totali 4 bice total: 7 Creditat 0 Roands: 162 Current file: LabProgram.java \begin{tabular}{l|l} 16 & ll Read starting credits \\ 17 & credits = scnr. nextInt(); \\ 18 & \\ 19 & \\ 20 & Insert your code here \\ 21 \\ 22 & 3 \end{tabular} File is marked as read only Current file: GVDie.java v File is marked as read only Current file: GVDie.java - 30 I/ Allows dice to be compared if necessary 31 public int compareTo(GVDie d) \{

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago