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

  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