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

  Investigation of object-oriented programming by creating

We begin our investigation of object-oriented programming by creating an object-oriented program with a class called Employee. You will create two objects based on the Employee class, along with a class that contains the main method. The attributes, ..

  What are search methods

What are search methods? Do you feel search methods are relevant to topics in artificial intelligence ? If yes, please explain why and how. Specifically, describe how search methods would be used for rule-based systems, expert systems, resolu..

  Discuss the role of the project manager or team

Summarize how the project manager or team exhibited exceptional and ethical project management practices. 2.Discuss the role of the project manager or team

  Event drive programming

Lets look at event drive programming. What is an event driven program? What are events associated with? What are examples of common events?

  Router cidr entries for ip addresses

A router has the following (CIDR) entries in its routing table:

  What is the full url

You wish to use HTTP version 1.1 to retrieve index.html on the base directory of a machine named example.com that is configured to accept connections on the smallest ephemeral port number. What is the full URL?

  What is meant by the term digital divide

"What is meant by the term digital divide?". Write an essay (about 1300 words plus references) on the meaning of the term, who is affected, and how. In the light of recent media interest you might include traditional businesses in your discuss..

  Peak view sound sources is a public company

Peak View Sound Sources is a public company based in Denver, Colorado and is focused on providing digital media and Web sites to music companies and musicians through the Mountain and West Coast regions. The company has a solid reputation and i..

  What is the probability of rolling the outcome snake eyes

What is the probability of rolling the outcome "snake eyes" (two ones) with these loaded dice? (c) What is the expected value of our random variable X with respect to this unfair distribution?

  How much electric power would be produced by these falls

Water flows over a waterfall, which is 120 m high, at a rate of 1.30E+6 kg/s. If half the potential energy of this water were converted into electric energy, how much electric power would be produced by these falls?

  Describe the necessary hardware and software components

Your company wants to create an application that allows employees to dial in from a remote location and using a single connection, access their voice mail, e-mail, and data files. What kind of system would allow this? Describe the necessary hardware ..

  What feature in windows vista provides a permission dialog

Moving from one NTFS partition to another creates one copy of the object. The object in the new location inherits the permissions of the new location. So the newly moved file cannot have different permissions than the original.

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