Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Write a program that simulates the rolling of two dice. The program should call rand to roll the first dice, and should call rand
- 1. Write a program that simulates the rolling of two dice. The program should call rand to roll the first dice, and should call rand again to roll the second dice. The sum of the two values should then be calculated. [Note: Because each dice has an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12 with 7 being the most frequent sum and 2 and 12 being the least frequent sums. The figure below shows the 36 possible combinations of the two dice]. Your program should roll the two dice 40,000 times. Use a single-subscripted array to tally the numbers of times each sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable, ( i.e, there are six ways to roll a 7), so approximately 1/6 of all the rolls should be a 7. (40 Points) 2. Write a program to display the following output using a single cout statement. (10 points) Subject Marks Mathematics 90 Computer Chemistry 3. 77 69 Write a program to sum the digits of given integer number. (10 points) 4. Write a program that lets the user perform arithmetic operations on two numbers. Your program must be menu driven, allowing the user to select the operation (+, -, *, or /) and input the numbers. Furthermore, your program must consist of following functions: 1. Function showChoice: This function shows the options to the user and explains how to enter data. 2. Function add: This function accepts two number as arguments and returns sum. 3. Function subtract: This function accepts two number as arguments and returns their difference. 4. Function multiply: This function accepts two number as arguments and returns product. 5. Function divide: This function accepts two number as arguments and returns quotient. (40 Points) Referencing and Plagiarism Direct quotations of 6 to 40 words must be included in double quotation marks followed by the author last name and page number. For direct quotations of more than 40 words you should use a blocked indented paragraph. However, your assignment should not be a mere copy and paste of other people’s work even if you properly reference it. Quoting or reproducing large sections of other work and referencing it does not earn any marks as it does not show that you understand the issues or that you can apply them. Try as much as possible to paraphrase other’s work and include your own opinions and examples. When you paraphrase, note that you still have to identify the source of your information. Marking The Student Assessment Feedback form gives you an indication of the marking criteria. Some key points are: In order to pass you must show that you understand most if not all the theory at a basic level and you can apply it. In order to get a high mark, you must show an in depth understanding of the material, a high level of analytic ability, extensive research and an ability to craft a well- structured answer. Instructions for Assignment Read the unit overviews, the associated chapters in the book, participate in the online discussions until week 7, read related research and answer the associated questions. This assignment carries the weight of 40% of your overall grade and should be submitted by the end of week 7 at the latest.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started