Absolute C++
Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 3, Problem 9PP

In the game of craps, a "Pass Line" bet proceeds as follows. The first roll of the two, six-sided dice in a craps round is called the "come out roll." The bet immediately wins when the come out roll is 7 or I I, and loses when the come out roll is 2, 3, or 12. If 4, 5, 6, 8, 9, or 10 is rolled on the come out roll, that number becomes "the point." The player keeps rolling the dice until either 7 or the point is rolled. If the point is rolled first, then the player wins the bet. If the player rolls a 7 first, then the player loses.

Write a program that plays craps using those rules so that it simulates a game without human input. Instead of asking for a wager, the program should calculate whether the player would win or lose. Create a function that simulates rolling the two dice and returns the sum. Add a loop so that the program plays 10,000 games. Add counters that count how many times the player wins, and how many times the player loses. At the end of the 10,000 games, compute the probability of winning, as Wins / ( Wins + Losses ) , and output this value. Over the long run, who is going to win more games of craps, you or the house?

Blurred answer
Students have asked these similar questions
A serendipity bookseller has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows: If a customer purchases 0 books, he or she earns 0 points. If a customer purchases 1 books, he or she earns 5 points. If a customer purchases 2 books, he or she earns 15 points. If a customer purchases 3 books, he or she earns 30 points. If a customer purchases 4 or more books, he or she earns 60 points. W rite a program that asks the user to enter the number of books that he or she has purchased this month and then displays the number of points awarded.   using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms; namespace Chapter_4_Problem_6___Seth{public partial class bookClubPoints : Form{public bookClubPoints(){InitializeComponent();}}}     C# please code with this context
Serendipity Booksellers has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows: If a customer purchases no books, he or she earns 0 points If a customer purchases 1 through 5 books, he or she earns 5 points for each book. If a customer purchases 6 through 10 books, he or she earns 10 points for each book. If a customer purchases 11 or more books, he or she earns points equal to 20 points for each book. (Use Python) Use the Design Recipe to write the function customer_rewards which consumes the number of books purchased, and returns the total points. Include a docstring! Write 3 assert_equal statements to test your function.
Q2 The Powerball Lottery 15 Points The Powerball lottery is based on a random drawing of six balls from two machines. One machine contains 69 white balls (labeled 1 through 69) and the other machine contains 26 red balls (labeled 1 through 26). To determine the winning numbers, the gamemaster draws five white balls from the first machine and one red ball (the "Powerball") from the second machine (assume all outcomes are equally likely). A player in the Powerball lottery picks five different numbers between 1 and 69 (inclusive) and a sixth number between 1 and 26 (inclusive), which may duplicate one of the first five numbers. For each of the following questions, you should write your answer as an expression. Do not give the final numeric value. For example, you should write C(4, 2)/24) instead of 0.375.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY