Write a program that simulates multiple games of blackjack

Assignment Help Basic Computer Science
Reference no: EM131305111

Blackjack (twenty-one) is a casino game played with cards. The goal of the game is to draw cards that total as close to 21 points as possible without going over. All face cards count as 10 points, aces count as 1 or 11, and all other cards count their numeric value.

The game is played against a dealer. The player tries to get closer to 21 (without going over) than the dealer. If the dealer busts (goes over 21), the player automatically wins (provided the player had not already busted). The dealer must always take cards according to a fixed set of rules. The dealer takes cards until he or she achieves a total of at least 17. If the dealer's hand contains an ace, it will be counted as 11 when that results in a total between 17 and 21 inclusive; otherwise, the ace is counted as 1.

Write a program that simulates multiple games of blackjack and estimates the probability that the dealer will bust. Hints: treat the deck of cards as infinite (casinos use a "shoe" containing many decks). You do not need to keep track of the cards in the hand, just the total so far (treating an ace as 1) and a bool variable hasAce that tells whether or not the hand contains an ace. A hand containing an ace should have 10 points added to the total exactly when doing so would produce a stopping total (something between 17 and 21 inclusive).

Reference no: EM131305111

Questions Cloud

Evaluate the impact of contemporary hr practices : Have a clear understanding of, and an ability to critically evaluate HRM and its role within the organisation and the wider the global environment - Be able to critically evaluate the main processes of employee resourcing, development, relations a..
What is the projected length of the project : What is the projected length of the project (in weeks)? What is the impact on the project (and the project manager) of changing the duration of task H from 2 weeks to 6 weeks?
End inventory level and inventory turnover ratio : Charlie's Cycles Inc. Has $110 million in sales. The company expects that its sales will increase 5% this year. Charlie's CFO uses a simple linear regression to forecast the company's inventory level for a given level of projected sales. Given the es..
Price of call option on the stock that has a strike price : Binomial Model The current price of a stock is $15. In 6 months, the price will be either $20 or $13. The annual risk-free rate is 4%. Find the price of a call option on the stock that has a strike price of $14 and that expires in 6 months.
Write a program that simulates multiple games of blackjack : Blackjack (twenty-one) is a casino game played with cards. The goal of the game is to draw cards that total as close to 21 points as possible without going over. All face cards count as 10 points, aces count as 1 or 11, and all other cards count t..
Call option on the stock that has a strike price : The current price of a stock is $22. In 1 year, the price will be either $28 or $15. The annual risk-free rate is 6%. Find the price of a call option on the stock that has a strike price is of $25 and that expires in 1 year.
Determines if the value is prime : Write a program that gets a starting value from the user and then prints the Syracuse sequence for that starting value.
Black-scholes option pricing model-what is options value : Black-Scholes Model Assume that you have been given the following information on Purcell Industries: Current stock price = $15 Strike price of option = $14 Time to maturity of option = 6 months Risk-free rate = 8% Variance of stock return = 0.11 d1 =..
Define a class to represent logical matrix : COMP3200: Object-Oriented Programming Assignment. Define a class (called LogMat) to represent logical matrix of any binary relation as explained previously. The class has three member variables: matrix (as dynamic 2-D array), rowSize and columnSize

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  How digital media has been used to influence

How digital media has been used to influence

  Build a simple network

Discuss with your Learning Team the components and behaviors of devices needed to build a simple office network based on the following office scenario:

  Process of simplifying a radical expression

In the process of simplifying a radical expression, an individual provides a decimal number as an answer. Is the individual's answer correct? Why or why not? Explain your answer.

  View several videos from the scholars of change website

Reflect on how you would like to harness all you have learned to be an agent for social change in your community as a health care professional.View several videos from the Scholars of Change website.

  Write a program that reads a value

Write a program that reads a value (say n) from the user and ouputs "Hello world" n times. Verify that the user has entered an integer. If the input is 3, the output will be "hello world" 3 times.

  Describe the scope and analyze how to control the scope

Describe the project including the describe the scope and analyze how to control the scope and identify possible risks, constraints, and assumptions.

  Contract closeout process

Regarding the contract closeout process, make at least one (1) recommendation for improvement that would benefit the government and one (1) recommendation for improvement that would benefit the contractor. Provide a rationale for each recommendati..

  List the four most popular sources of digital media

What are the three major components of satellite radio, from a technology standpoint?

  Consider a feasible max-flow problem

Show that if the upper flow bound of each arc is increased by α > 0, then the value of the maximum flow is increased by no more than αA, where A is the number of arcs.

  Plot calculated column vs time

Plot Calculated Column 2(CC2) vs. Time (in minutes please). All runs in one plot. you have about 10 runs, I need you plot all these runs in one graph.

  Role of it in the contemporary business organization

Understand the central role of IT in the contemporary business organization. Understand the impact of the World Wide Web on the management of business

  Prudent level of debt will protect companies

Research "prudent level of debt" for one of the following companies: Hershey Foods, Verizon, AT &T or EG&G. Discuss how a prudent level of debt will protect companies from financial distress and ensure access to money and capital markets under mos..

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