Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java code all written in the main method Due to the various game - variables and match - variables, all the code should be contained

Java code all written in the main method
Due to the various game-variables and match-variables, all the code should be contained only within the main() method. Other methods may be introduced to 'compartmentalize' code to facilitate readability and avoid repeating code unnecessarily; do not repeat code. However, since many game/match variables need to change almost simulataneously and methods return only one variable, program development will be facilitated if all code is contained within the main() method.
Example #1: 1 run with 1 winner:
Welcome to the 'Shut the Box' Game.
Begin playing game #1.
Enter a seed:
-44
The available number(s) are: 123456789
The dice roll is 6 and 5 for a sum of 11.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
38
The available number(s) are: 1245679
The dice roll is 6 and 3 for a sum of 9.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
9
The available number(s) are: 124567
The dice roll is 3 and 5 for a sum of 8.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
17
The available number(s) are: 2456
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
2
The dice roll is 1 and 3 for a sum of 4.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
4
The available number(s) are: 256
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
1
The die roll is 2.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
2
The available number(s) are: 56
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
2
The dice roll is 4 and 2 for a sum of 6.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
6
The available number(s) are: 5
The player may opt to roll 1 die or 2 dice because tiles 7,8, and 9 are "closed".
Enter "1" to roll 1 only die or "2"(or any other key) to roll 2 dice.
1
The die roll is 5.
Which tile(s) should be "closed"? Separate multiple tiles with a space.
5
Congratulations, you won!
Do you wish to play again? Enter Yes to play again or anything else to quit.
No
Thank you for playing "Close the Box"! The total score is 0 with 1 win(s) after 1 round(s).

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

Step: 3

blur-text-image

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions