• 100% Satisfaction Guarantee
Category: Homework
Satisfied Customers: 3040
Experience:  MIT Graduate (Math, Programming, Science, and Music)
3546829
Scott is online now

# As it is played today, bunco is a social dice game involving

### Customer Question

As it is played today, bunco is a social dice game involving 100% luck (
no skill since
there are no
decisions to be made), scoring and a simple set of rules. Players are divided into teams. Each team
throws 3
dice, keeping track of their own scores. The first team to 21 wins the round (
Bunco!
).
Scoring:

Roll 3 sixes: 21 points (automatic
Bunco!
)

Roll 2 sixes: 5 points

Roll 1 six: 1 point

Roll no sixes: 0 points
For this assignment you will declare 3 class variables and 2 methods. Because these are all
used/invoked within
main
, which is a static
method, all must be declared as static.
Class Variables:
In Java, you may create Class
V
ariables that can be
used
within the
main
method as well as all
other methods
in the class
. Because you will be writing 2 methods in addition to
main
, there are 3
integer class variables you should declare:
1.
Current team that is rolling the di
c
e; initialize to 1, representing team 1
who rolls first
2.
Team 1’s current score
; initialize to 0
3.
Team 2’s current score
; initialize to 0
Note: these should be declared within t
he
class
but before
main
.
Also, because main and
the two methods
are static, these variables must also be static.
Rolling
a
die:
In Java, simulate rolling a die using random integers:
i
nt
roll1, roll2, roll3;
Random die = new Random();
r
ol
l
1
= die.nextInt(6) + 1;
// similar code
used for roll 2 and roll 3
Keep in mind that Random is in the java.util package so you will need to import it.
Method
bunco
:
1.
Return value: integer
, the points resulting from the roll of the dice
2.
Method name: bunco
3.
Parameter List:
three
arguments:
three
integer
s
representing the roll of
each die.
4.
Algorithm:
a.
Output the roll of
each of the die (See Sample Output)
.
b.
If roll1, roll2, and roll3 are all 6’s, output the phrase
Bunco!
and
return 21.
c.
If two of the three rolls are 6’s, output the phrase
Box Cars
and return 5
.
d.
If any one of the rolls is a 6, return 1
.
e.
If none are 6, return 0
.
Method
winner
:
1.
Return value: void
2.
Method name: winner
3.
Parameter List:
empty
4.
Algorithm:
a.
If team1 has won (more than 21 points), output they are the winner as well as their
total points.
b.
If team 2 has won (more than 21 points), outp
ut they are the winner as well as
their total points.
c.
If no team has won, then if team 1 is the current team, output their current score
and change the current team to 2 since team 2 will be the next to roll the dice.
Otherwise, output team 2’s current sco
re and change the current team to 1.
Simulating the game
:
Y
ou will simulate
one
table of bunco (
2
teams of players).
You will need to keep track of the
round number, where a round is completed after both teams have rolled (or a winner is
declared).
B
(i.e., within the while loo
p) by rolling the dice. Call the
bunco
method
to determine the points to be added to the team

s score
, either team 1

s score or team 2

s score
.
If team 1 just rolled, then change the current team to 2. If
,
team 2 just rolled, change the
current
tea
m to team 1. Then, call the
wi
nner method to determine if there is a
win
n
er
.
C
ontinu
e play
until
either
team has reached a score of 21. For each roll of the die, output the round number
,
the team who is rolling, and what they rolled
.
Sample Output
:
Round 1, Team 1's roll
1
--
3
--
4
Team 1’s
Current Score: 0
Round 1, Team 2's roll
4
--
2
--
6
Team 2’s
Current Score: 1
Round 2, Team 1's roll
5
--
4
--
2
Team 1’s
Current Score: 0
Round 2, Team 2's roll
1
--
3
--
5
Team 2’s
Current Score: 1
Round 3, Team 1's roll
1
--
1
--
3
Team 1’s
Current Score: 0
Round 3, Team 2's roll
4
--
3
--
3
Team 2’s
Current Score: 1
Round 4, Team 1's roll
5
--
5
--
3
Team 1’s
Current
Score: 0
Round 4, Team 2's roll
4
--
6
--
2
Team 2’s
Current Score: 2
Round 5, Team 1's roll
1
--
2
--
6
Team 1’s
Current Score: 1
Round 5, Team 2's roll
6
--
3
--
1
Team 2’s
Current Score: 3
.
.
.
Round 9, Team 1's roll
2
--
5
--
4
Team 1’s
Current
Score: 6
Round 9, Team 2's roll
5
--
6
--
5
Team 2’s
Current Score: 4
Round 10, Team 1's roll
6
--
4
--
4
Team 1’s
Current Score: 7
Round 10, Team 2's roll
4
--
6
--
5
Team 2’s
Current Score: 5
Round 11, Team 1's roll
6
--
6
--
6
Bunco!
Team 1 wins
with a score of 28
Submitted: 6 months ago.
Category: Homework
Expert:  Bruce Wilner replied 6 months ago.

You need this coded in Java for you?

Customer: replied 6 months ago.
heres the pdf but that offer is too expensive for me. The assignment was due last night. I don't feel comfortable paying that amount for a late assignment.