Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to implement Round counting. I have attached the sample output. .............. import java.util.Random; public class Craps_Games { /** * @param args the command line

How to implement Round counting. I have attached the sample image text in transcribed output.

..............

import java.util.Random; public class Craps_Games { /** * @param args the command line arguments */ public static int roll() { Random randomGenerator = new Random(); int Die1 = randomGenerator.nextInt(6) + 1; int Die2 = randomGenerator.nextInt(6) + 1; System.out.print( " Round, Roll -- Die1: " + Die1 + " , Die2: " + Die2); return Die1 + Die2; } public static void main(String[] args)throws java.lang.Exception { // TODO code application logic here int wins = 0; int loss = 0; for (int i = 0; i Round 1 Roll 1 -Diel: S, Die2: 5 Total: 10 Point ia 10 Round 1 Roll 2 -Diel: s, Die2: 1 - Total: 6 Round 1Roll 3Diel: 6 Die2: 6-Total: 12 Round 1 Roll 4Diel: 2Die2: 4 -Total: 6 Round 1,Roll 5 Diel: 2, Die2: 5 Total:7 LOSS! win(a)1 loss (ea) Round 2 Roll 1 Diel:,Die2: 6 -- Total: 7 WIN! win(a)1 loas (es) Round 3,Roll 1 Die1: 3, Die2: 5Total: Point is 8 Round 3 Roll 2 -Diel: 3,Die2: 5 -- Total: 8 WIN 2 win(a)1 1osa (es) Round Ro11 1--Diel: 6, Die2: --Total: 10 Point is 10 Round Roll 2Diel: 6Die2:1Total: LOSS! 2 win(a)2 loaa (ea Round S Roll1 Point is s Diel:1, Die2: 4 -- Total: 5 Round S Roll 2 - Diel:, Die2: 4 -- Total: 5 WIN 3 win(a)2 loas (ea) Round 6 Roll 1-Diel: 2Die2: 5 Total:7 WIN 4 win(s)2 loss (es) Round 7,Roll 1 - Diel:, Die2: 5 Total: 6 Point is 6 Round 7 Rol12 -Diel: 2, Die2: 5Total: 7 LOSS! 4win(s)3 loss (ea) Round 8, Roll 1Die1: 3 Die2: 3 Total:6 Point is 6 Round 8, Roll 2Diel: 3 Die2: 2 Total: S Round Roll 3--Diel: 4 Die2: 6Total:10 Round 8Roll 4Diel: 6,Die2: 3Total:9 Round 8 Roll sDie1: 4 Die2: 2 Total:6 WIN win(s)3 loss (es) Round 9,Roll 1 -Diel:3, Die2: 4 Total: 7 WIN! win(a)3 loaa (ea) Round 10, Roll 1 -- Diel: 5 Die2: 3Total:8 Point is Round 10Roll 2Diel: 4, Die2: 4 Total:8 WIN! 7 win(s)3 loss (es) OVERALL 9156 win(a)S0844 loss (ea)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions