Prompt the user for the number of sides

Assignment Help Basic Computer Science
Reference no: EM13841368

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: EM13841368

Questions Cloud

Analysis of a recent ethics scandal : Prepare a 250 word analysis of a recent ethics scandal. Report should discuss the conditions that five raise to unethical business strategies and behaviour
Develop a data dictionary and create an e-r diagram : Identify the entities and relationships that are relevant for a system to manage SEAMM. Develop a data dictionary (catalogue) and create an E-R diagram.
Research participation opportunities on the radio : Researchers often advertise their research participation opportunities on the radio and in towns with a large student population. Research participants receive information about the studies and are typically paid for their time or participation. Do y..
What is the role of an institutional review board : What is the role of an Institutional Review Board (IRB)? How does an IRB protect the rights of human subjects participating in research?
Prompt the user for the number of sides : 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 ..
Role of training and development in learning organizations : What is the role of training and development in learning organizations?  Do you think that a pharmaceutical company could effectively manage knowledge without having well-developed training and development activities? What are the elements of total c..
Describe the swla region : Write a 500 word or more essay about SWLA. You can use information from the library, as well as online. The essay should describe the SWLA region, which parishes are included, what is the SWLA economy
Operating system suitability assessment plan : Develop a tool that helps companies in assessing the suitability of different operating systems for their businesses. This tool is a table with multiple rows and columns - Operating System Suitability Assessment Plan.
Impact of lead time on order amounts and service levels : What is the impact of lead time on order amounts and service levels? How does demand and variability play a role?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Container that holds the water

The container that holds the water for the football team is 3/10 full. After pouring in 11 gallons of water, it is 4/5 full. How many gallons can the container hold

  Create a method that prints rectangle characters to console

Create a method that prints a rectangle of characters to the console

  Define the contested boundaries among amazon

Define the contested boundaries among Amazon, Apple, Facebook and Google

  Difference and similarity between matlab and vba syntax

1. What's one difference you've noticed between MATLAB and VBA syntax? What is one similarity?

  Distinguish between data and information

Distinguish between data and information

  Is it possible for an instruction to be receiving forwarding

Is it possible for an instruction to be receiving forwarding information and simultaneously being flushed?If possible, can you provide an example sequence of instructions?

  Explain one technological device

Explain one technological device in 350 to 700 words. Include the following:When did it come (or will it potentially come) into existence? What scientific or technological reasoning explains how this potential will be (or can be) be reached in t..

  Write a select statement that returns four columns

Write a SELECT statement that returns four columns: VendorName

  What are the advantages of a web server

What are the advantages of a Web server?

  What are popular database management systems why use oracle

What are some of the more popular database management systems? Why use Oracle

  Develop monthly claim status summary report

Dr. Jones has asked you to develop a monthly Claim Status Summary report. He wishes you to write the insurance company number, patient number and name.

  An increase in consumer confidence raises consumers

Suppose that an increase in consumer confidence raises consumers' expectations about their future income and thus increases the amount they want to consume today. This might be interpreted as an upward shift in the consumption function. How does this..

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