Generating two random numbers

Assignment Help Basic Computer Science
Reference no: EM131570954

Make a program to simulate the rolling of two six-sided dice. The program should work by generating two random numbers, each in the range of 1 to 6, to represent the two dice. The sum of the two values should then be calculated. Use a loop to roll the dice millions of times and use a one-dimensional array to keep a count of how many times each sum appears. Here's a snippet you can use. Assume counts is declared like this: int[] counts = new int[13];

int die1 = 1 + (int) (Math.random() * 6);

int die2 = 1 + (int) (Math.random() * 6);

int sum = die1 + die2;

counts[sum]++;

Practice 2

Make a program that will play Tic-Tac-Toe. The game board will be a 2D array. Allow two human players. Wherever the first player moves, place an X in the specified square, and place an O wherever the second player moves. Each move must be to an empty square. After each move, determine whether the game has been won and whether it's a draw.

Reference no: EM131570954

Questions Cloud

Operating system security : Operating systems play a role in a number of contexts within an enterprise network. There are those who have preference for a particular operating system
What is the problem of polarizing healing techniques : Does the promotion or lack of promotion of CAM techniques confirm this gap in healing modalities? Explain how?
Write a reflection paper for winning presentation : Write a reflection paper for winning presentation. Have you used the skills from this class in your day-to-day life or other classes?
What does your assessment imply for future business : Assess the financial value of the company using relevant indicators. What does your assessment imply for future business health and performance?
Generating two random numbers : Make a program to simulate the rolling of two six-sided dice. The program should work by generating two random numbers, each in the range.
How does this differ from a mail client on your pc : How does this differ from a mail client on your PC? What is a peer-to-peer network? Can you think of an example of such a network you have used?
Write alibaba background and history of operation in china : Do a research about Alibaba company. Write a Company background and history of its operations in China. 2-3 pages long with double spaces.
Design in developing a program : Consider the importance of program design in developing a program that interacts with the user.
What philosophical statements did your characters explore : What philosophical statements did your characters explore? What kind of assignments tend to be easy for you? What do you struggle with?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd