Absolute C++, Student Value Edition, 6/e
Absolute C++, Student Value Edition, 6/e
6th Edition
ISBN: 9780133970982
Author: SAVITCH
Publisher: Pearson Education
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 11PP

You are a contestant on a game show and have won a shot at the grand prize. Before you are three doors. $1,000,000 in cash has randomly been placed behind one door. Behind the other two doors are the consolation prizes of dishwasher detergent. The game show host asks you to select a door, and you randomly pick one. However, before revealing the prize behind your door, the game show host reveals one of the other doors that contains a consolation prize. At this point, the game show host asks if you would like to stick with your original choice or to switch to the remaining door.

Write a function to simulate the game show problem. Your function should randomly select locations for the prizes, select a door at random chosen by the contestant, and then determine whether the contestant would win or lose by sticking with the original choice or switching to the remaining door. You may wish to create additional functions invoked by this function.

Next, modify your program so that it simulates playing 10,000 games. Count the number of times the contestant wins when switching versus staying. If you are the contestant, what choice should you make to optimize your chances of winning the cash, or does it not matter?

Blurred answer
Students have asked these similar questions
plz solve it asap ????????: Write a program for a game that consists of two players. The rule of the game is that player 1 inputs a random number from 1-100. Player 2 will input 5 numbers. If the summation of those numbers is equal to the number OR less than or greater than the number by 3 (+3 or -3), then player 2 wins. Otherwise, player 1 wins. Test Case 1 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 7 Output Player 2 wins Explanation: The summation of 10,10,20,5 and 7 is 52 which is greater than 50 by 2. According to the rule, player 2 wins. Test Case 2 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 1 Output Player 1 wins Explanation: The summation of 10,10,20,5 and 1 is 46 which is less than 50 and also doesn’t…
You're hosting a game show that needs a wheel of fortune. Your task is to test if the wheel of fortune works well. To do this, spin the wheel several times and write down normalized deviation angles from the initial state so that the results range between 0 and 1. The wheel of fortune is suitable for the show if the results are evenly distributed on the interval [0, 1]. You will get the following 25 observations:0.42 0.06 0.88 0.40 0.90 0.38 0.78 0.71 0.57 0.66 0.48 0.35 0.16 0.22 0.08 0.110.29 0.79 0.75 0.82 0.30 0.23 0.01 0.41 0.09Use a suitable program language (e.g. R or Python) and a Kolmogorov–Smirnov test to check whether the wheel of fortune is suitable. Determine the p-value.
A group of people, numbered 1 to N, are sitting in a circle. Starting at person 1, a hot potato is passed. After x number of passes, the person holding the hot potato is eliminated, the circle closes ranks, and the game continues with the person who was sitting after the eliminated person picking up the hot potato. The last remaining person wins. For example: number of passes = 1 and number of players   = 5, the order of elimination is 2, 4, 1, 5.    Write a program for general values of X and N. Ask a user for the number of people and number of passes To speed up the input and debugging, you may wish to store the names of the people in a file. Make sure no two names start the same letter ( Alex and  Ana are not OK). Alternatively, you can number the players. Output number and/or the name of a person being eliminated Output number and the name of the winner Do not expect a user to do the right thing, error check the user input; among other things, what do you think a reasonable…

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
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
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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