Prompt the user for the number of sides on the die

Assignment Help Basic Computer Science
Reference no: EM13842915

Problem 1: Dice Write a program that simulates rolling one die

Write a program that simulates rolling one die using the following steps:


1.Prompt the user for the number of sides on the die.
2."Roll" the die three times by generating a random number between 1 (inclusive) and the number of sides (inclusive).
3.Keep track of the running sum of the rolls for the die and output the sum and average for the three rolls at the end.
4.You can set up one integer variable named roll, and reuse it with each roll of the die. You will also need a variable named total, initialized to zero.

Sample Output:

How many sides on die? 6
First roll = 5
Second roll = 1
Third roll = 3
Die total = 9 
Average roll = 3 

How many sides on die? 20
First roll = 14
Second roll = 20
Third roll = 9
Die total = 43 
Average roll = 14.333

Reference no: EM13842915

Questions Cloud

Theurl of the article : Find 1 article related to  security and the cloud. and to turn in the following: (1) TheURL of the article, (2) A brief summary of the article
Principles of good design and usability attributes : All assignments must be prepared in double-space format, 12 pt. type (preferably TimesRoman), and should include a title page, table of contents, and reference list. Allsubmitted work should contain student name and course number and term
Standard deviation abstract : Standard Deviation Abstract
First describe the mission of each organization : First describe the mission of each organization, as found on their web site.  Discuss how each organization has been targeted in the recent past for cyberattack(s), as reported in news or journal articles.  Describe the suspected threat actors.  Disc..
Prompt the user for the number of sides on the die : 1.Prompt the user for the number of sides on the die.2."Roll" the die three times by generating a random number between 1 (inclusive) and the number of sides (inclusive).3.Keep track of the running sum of the rolls for the die and output the sum and ..
What is the calculated t value : Conduct a hypothesis test and What is the calculated t value? Are the mean test scores of these two groups significantly different at the .05 level - Conduct a hypothesis test.
Write a grand strategy plan addressing : Write a grand strategy plan addressing
Explain how companies can use information technology : Explain how companies can use Information Technology to make their businesses more competitive. Provide at least 1 or 2 examples and explain how they help.
Review the segmentation data : review the segmentation data

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Develop a c# console application

Develop a C# console application that implements two int arrays. One array will hold 10 randomly generated integer numbers, the second array will hold 10 integer numbers entered from the console.

  Automobile customers are billed

Suppose automobile customers are billed at the rate of $35 per hour for labor. Also, costs for parts and supplies are subject to a 5% sales tax. Write a program to print out a simplified bill.

  Good design process and incorporates

your final project will be to analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements and the use of at least one array. The specific problem y..

  Each office connects to via a wide area network (wan)

Application Architecture You have been tasked with building a payroll program for a large organization with offices spread across the United States. The company has one larger data center that each office connects to via a wide area network (WAN).

  Make this code appear from right to left it is html code

Please make this code appear from right to left, it's HTML Code

  What properties can be added in referential integrity

What properties can be added in referential integrity

  Program using an array

The array contains the hours worked for 5 employees. These hours are entered by the user. All employees earn the same hourly wage. The program will calculate the gross pay for each employee.

  How you identify a protected item in a uml diagram of c

How would you identify a protected item in a UML diagram of C++

  initialize the temperature to 100 degrees celsius

Initialize the temperature to 100 degrees Celsius. In a loop, decrement the Celsius value and compute the corresponding temperature in Fahrenheit until the two values are the same.

  Review the code of ethics of the institute of electrical

Review the code of ethics of the Institute of Electrical and Electronics Engineer (IEEE) and National Society of Professional Engineers (NSPE).

  How to operate a computer system

Compose a letter to simon on how to operate a computer system

  A retail department store is approximately square

A retail department store is approximately square, 300 feet on each side. Each wall has two entrances equally spaced apart. Located at each entranced is a point-of-sale cash register.Suggest a locate area network solution that interconnects all eight..

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