Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: you'll build on the CoinFlip.java program. The coin simulation asked you to flip a coin 1000 times and report the outcomes. For Lab

Part 1: you'll build on the CoinFlip.java program. The coin simulation asked you to flip a coin 1000 times and report the outcomes. For Lab 1, you should create a class called DiceSim.java (or similar), which simulates the rolling of five six-sided dice 7,776 times and reports the number of Yahtzees (five of a kind) rolled.

You'll either need to use a random generator (java.util.Random) or reuse the Math.random() function, but you'll need to tweak it to simulate a die with sides 1..6 in place of a coin with only 0 and 1 as options. Make sure you don't roll any 0's or 7's...

Part2: Now build a 2-dimensional array that is 5x5 and populate it with random rolls like you did above. Once youve populated the 2-D array I want you to print the 2-D array to the output screen then print how many Yahtzees exist in each row, how many Yahtzees exist in each column and how many Yahtzees exist on the diagnals. A sample output could look like this

45631

52411

65121

41351

15321

There are 0 row Yahtzees

There are 1 column Yahtzees

There are 1 diagonal Yahtzees

Both part 1 and part 2 should reside in the same program

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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

What are the tax implications of investing in nonfinancial assets?

Answered: 1 week ago