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

  Smartphones and the great digital divide

we present some data regarding smartphone adoption and usage by ethnicity, gender, income, and education. It's very interesting to see how different groups use smartphones in different ways.

  Powerpoint presentation—training program design

PowerPoint Presentation-Training Program Design

  Program that asks the user to enter two decimal numbers

Write a program that asks the user to enter two decimal numbers - The program should calculate and display the product and quotient of the two numbers. Use a function Product() to calculate the product.

  How can a network designer determine if they are important

How can a network designer determine if they are important, and how are they taken into account when designing a data communications network?

  Systems analyst modifying the sales order process

Suppose that you are a systems analyst on a project that involves modifying the sales order process. How many do you need to sample if you want 95 percent certainty that you have covered all variations?

  Thread problem

Implement what is kind of the inverse of our Producer - Consumer, where many Producers supply a limited capacity consumer.

  Can a quantum computing bit-s multiple states contribute

Can a quantum computing bit's (qbit's) multiple states contribute any more computing power or hold any more extraordinary mathematical control/significance.

  The mode of a list of values is the score

For this project you will write a program to compute the arithmetic mean (average), median, and mode for the values read in from TopicFin.txt. The program results will be written to TopicFout.txt.

  Which method would be efficient for planning proactive

Process-centered review of object oriented software development methodologies, ACM Computing Surveys (CSUR), Volume 40 Issue 1, February 2008, Raman Ramsin, and Richard F. Paige.

  How do you define the frequency or cycling

Filters exist in natural systems, biosystems, psychsystems, mechanical, etc. Give an example of filtering in nonelectronic area

  Athens medical claims reengineering

Athens Medical Claims Reengineering

  Calculate a checksum that is the modulo 8 sum

How do you calculate a checksum that is the modulo 8 sum of all the bytes in the following packet C4 04 03?

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