Simulate and implement a game of blackjack

Assignment Help JAVA Programming
Reference no: EM131112114

Java

Project: BlackJack

This is an individual project, to be completed on your own. It is considered dishonest either to read someone else's solution or to provide a classmate with a copy of your work. Do not make the mistake of thinking that superficial changes in a program (such as altering comments, changing variable names, or interchanging statements) can be used to avoid detection. If you cannot do the work yourself, it is extremely unlikely that you can succeed in disguising someone else's work. We are adamant that cheating in any form is not tolerated. Even the most trivial assignment is better not done than if you cheat to complete it.

Prerequisites

1. Primitive types
2. Simple arithmetic operations
3. Conditionals
4. Loops
5. Scanner class

Learning Objectives

1. Problem solving
2. Building interactive programs, that is, getting input from the user
3. Using conditionals and loops to guide the program behavior

Introduction

In this project you will simulate a game of BlackJack. You will implement the logic for a round; you will also provide the user with the option to play another round or exit the game.

Game Rules

Blackjack, also known as 21, is a very popular casino game between a player and a dealer. It is played with a deck of 52 cards. For this project, we will consider the simplest version of the game.

The goal of the game is for the player to obtain a hand of cards that beats the dealer in one of the following ways:

1. Get 21 points on the first two cards, this is called a BlackJack. Note that if the dealer gets a BlackJack (21) on the first two cards, no matter what, the dealer wins.

2. Reach a final score higher than the dealer without exceeding 21

3. Let the dealer draw additional cards until her hand exceeds 21

At the beginning of the game, the player is dealt two cards and the dealer takes two cards. The value of their cards are added together to update each of their scores. Face cards (King, Queen and Jack) are counted as 10 points. Ace cards are counted as 11 and any other cards are counted as the numeric value shown on the card. If the player scores 21 on the first two cards, and the dealer doesn't, he gets a BlackJack and immediately wins. If the dealer gets a BlackJack, the player loses, no matter the score.

After receiving their first two cards, if the game continues, the player has the option of getting additional cards, one by one, which is called a hit. If the player scores higher than 21 at any given point is called a bust and results in an immediate loss. Every time the player hits, the dealer must also hit, unless her total score is 17 or more. Once the dealer reaches or exceeds 17, she can't take any more cards.

Once the player has decided he doesn't want to hit anymore, the round has ended. The player wins by not busting and having a total higher than the dealer's. The dealer loses by busting at the end of the round or having a lesser hand than the player who has not busted. If the player and dealer have the same total, this is called a push and it is considered a tie.

Discussion: From description to code

The rules of Blackjack were explained in the previous section. But now, how to go from the description of the rules to a Java program? As this is your very first project, we will give you some help.

From the Blackjack description, we know that we need to represent in Java two "objects", that is:

1. a card, that represents a single card in a 52 deck.
2. the deck of 52 cards.

Attachment:- Java_Project_BlackJack.rar

Reference no: EM131112114

Questions Cloud

What is the behavioral finance challenge to this hypothesis : What does the efficient-market hypothesis (EMH) say about (a) Securities prices, (b) Their reaction to new information, and (c) Investor opportunities to profit? What is the behavioral finance challenge to this hypothesis?
Describe the events that occur in an efficient market : Describe the events that occur in an efficient market in response to new information that causes the expected return to exceed the required return. What happens to the market value?
What role does an investment banker play in a public : What role does an investment banker play in a public offering? Describe an underwriting syndicate.
Managing the inventory for the trendy upscale : You are responsible for managing the inventory for the trendy upscale specialty food store, Partial Foods. You are trying to set the inventory policy for one of your most popular cheeses, Mad Cow Cheddar, which comes in 1 pound wheels. It is a ..
Simulate and implement a game of blackjack : In this project you will simulate a game of BlackJack. You will implement the logic for a round; you will also provide the user with the option to play another round or exit the game.
What general procedures must a private firm follow : What general procedures must a private firm follow to go public via an initial public offering (IPO)?
The opportunities and avenues for pr practitioners : We have been looking at the opportunities and avenues for PR practitioners to disseminate their messages to the mass media - practices that utilize social media in addition to traditional media platforms. And soon you will be developing a News Rel..
What are the four ways that vcs are most commonly organized : What are the four ways that VCs are most commonly organized? How are their deals structured and priced?
What is the difference between a venture capitalist : What is the difference between a venture capitalist (VC) and an angel capitalist (angel)?

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Prepare executable program and a dictionary program

Prepare executable program and a dictionary Program.

  What is polymorphism concept means and give an example

what this concept means and give an example to illustrate your understanding of the topic. You must use Java classes and Java interfaces to help with your description.

  Explain the tasks occur in exception handling

Calculate the letter grade the student has earned based on the average of these assignments.

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  The objective is to implement a menu-based system for bank

the objective is to implement a menu-based system for bank accounts in order to simulate a very simple banking system.

  Write an interactive program to maintain the space city

Write an interactive program, in Java, to aid in monitoring and maintaining all aspects of Tasks, Crew and Ship's, that is, maintaining the Space City.

  Java application that can hold five doubles in an array

Write a Java application that can hold five doubles in an array, and display the doubles from first to last, and then display the doubles from last to first. Use the following logic for BubbleSort to sort and display the array in sequence.

  Your task is to design and implement a sorting

your task is to design and implement a sorting algorithmalgorithm that can sort nonnegative integers that fall within

  Write a java program that prompts the user

Write a Java program that prompts the user to input three numbers.  This program should then output the numbers in an ascending order.

  In a method named setfavoritesports declare

In a method named setFavoriteSports declare the sports array and populate it.  This method will return the sports array to the calling statement.  The 9 in the prompt below will print 1 for the first sport, then 2 for the 2nd one and so forth.  Use t..

  Implement 4 sorting algorithms in a java "sort" class.

Implement 4 sorting algorithms in a Java " Sort " class. ( insertion sort, selection sort and quicksort, and mergesort). count the number of comparisons made.

  Display the values that were typed in to the form

This assignment will focus on creating Java Server Pages (JSP) and deploying them onto a Java Servlet Container.

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