Using Java
You are helping a corporation create a new system for keeping track of casinos and customers. The system will be able to record and modify customer and casino information. It will also be able to simulate games in the casino.
Customer-specific requirements
You can create new customers
All new customers have a new customerID assigned to them, starting with 1 for the first, 2 for the second, 3 for the third, ect.
New customers have names and monetary balances
Default values are “default customer” for name and 1000 for balance
You can add or subtract from a customer’s balance
Customer balances cannot go below 0
You can change a customer’s name
You can display a customer’s name and his or her balance
Casino-specific requirements
You can create a new casino
All new casinos have a new casinoID assigned to them, starting with 1 for the first, 2 for the second, 3 for the third, ect.
New casinos have names and monetary balances
Default values are “default casino” for name and 50000 for balance
You can add or subtract from a casino’s balance
Casino balances cannot go below 0
Casinos offer 4 different games that customers can play
Twenty-one
High Low
Seven-Eleven
Slots
You can change a casino’s name
Changing a casino’s name subtracts the casino’s balance by 15000
You can display a casino’s name and its balance
Game requirements
All casino games are played by a customer against the casino. In games with dealers, the dealers represent the casino.
Any bets placed by the user and casino are deducted from the respective balances of both parties
Lost bets are added to the casino balance.
Amounts lost by the casino are deducted from the casino balance and added to the customer’s balance.
If a bet would cause either a casino or customer balance to go negative, that bet cannot be placed.
Bets cannot be 0 or negative.
Seven-Eleven
The game is played with dice. The objective of the game is to roll a seven or an eleven first.
Gameplay as follows:
The user makes a bet, the casino matches the amount to create the pot
The user and the casino each roll 2 six-sided dice simultaneously. The sum of both die is that player's total
If a player rolls a 7 or 11 and the other does not, the player with the 7 or 11 wins
If neither player rolls a 7 or 11, roll again
If both players roll a 7 or if both players roll an 11, roll again
If one player rolls a 7 and the other rolls an 11, the one who rolled an 11 wins
The winner wins the pot and adds the money to their balance
Twenty-One
The game is played with cards. Number cards (2,3,4,5,6,7,8,9,10) are worth their shown values. Other cards (Jack, Queen, King, Ace) are worth 10. The objectives of the game are to get cards as close to the value of 21 without going over and to beat the dealer. Assume the casino is using multiple decks for Twenty-One. Duplicates can be drawn in the same game.
Gameplay is as follows:
The user makes a bet, the casino matches the amount to create the pot
2 cards are dealt to the player, 2 cards are dealt to the dealer
The user can see both of their cards and one of the dealer’s cards
The user can choose to either draw a new card or stay with their current hand
If a user chooses to draw and their hand total exceeds 21, the casino wins
Once the user chooses to stay, the dealer will either draw a new card or stay
If the dealer’s hand is 17 or higher, they stay. If it is lower than 17, they draw
If the dealer draws and their hand total exceeds 21, the user wins
If both the dealer and the user stay, the totals are compared and the higher total wins
In case of a tie, the customer receives the initial bet back
The winner wins the pot and adds the money to their balance
Slots
Gameplay as follows:
The user is asked for the number of spins
Every spin costs the customer 5, this is added to the casino balance
Each spin, one of the following outcomes occurs:
70% chance to win 1 from the casino
20% chance to win 5 from the casino
9% chance to win 10 from the casino
1% chance to win 100 from the casino
Display the amount the user won
Repeat steps 2 to 4 until the number of spins are complete
High Low
The game is played with cards. The rank
of the cards from low to high is as follows: A,2,3,4,5,6,7,8,9,10,
Jack, Queen, King. The objective of the game is to guess whether
the next card is going to be higher or lower than the current card.
Assume the casino is using one deck for High Low, so no duplicates
of cards can be drawn in the same game.
Gameplay as follows:
The user makes a bet, the casino matches the amount to create the pot
If this is not the first round, the new pot is combined with the previous pot
A card is drawn and shown to the user, the user guesses if the next card will be high or low. Ties are considered high
If incorrect, the casino wins
If the user is correct, ask if they want to continue or if they want to stop.
If the user continues, repeat steps 1 through 4
If the user stops, the user wins
The winner wins the pot and adds the money to their balance
If the user won and guessed correctly at least 4 times, they win
the pot and an additional 50 from the casino
Program requirements
In your main method, create a menu that a user can navigate through. Create the options to complete the following tasks:
Create a new customer
Create a new casino
Change a customer’s name
Change a casino’s name
Play games as a customer
Display customer details
Display casino details
Project Checklist
Submissions should include the following:
Project .java files
2 Flowcharts
UML Diagram
Test cases
Group feedback
.java Files
Initialize your program with 3 customers and 3 casinos. Set different names and money amounts for each. Your program should be clearly labeled throughout with pseudo-code. Comments are not only a component of your grade, but will also give me a better understanding of your program if it crashes at any point.
Flowchart and UML Diagrams
Create 2 flowcharts representing the flows of any 2 of the games. The UML diagram should represent the entire program and clearly indicate classes, class variables, and methods
Test Cases
Create screenshots that demonstrate the following requirements:
1.)Creating a new customer
2.)Creating a new casino
3.)Changing a customer name
4.)Changing a casino name
5.)1 game of twenty-one where the customer wins
6.)1 game of twenty-one where the casino wins
7.)1 game of high low where the customer wins (any amount)
8.)1 game of high low where the customer loses
9.)1 game of seven eleven where the customer wins
10.)1 game of seven eleven where the customer loses
11.) 1 game of slots with 5 spins
Display the name and bankroll of the customer and the casino interacting before and after games for cases 5 through 11. Label all screenshots and organize them into a word document
You can create new customers
All new customers have a new customerID assigned to them, starting with 1 for the first, 2 for the second, 3 for the third, ect.
New customers have names and monetary balances
Default values are “default customer” for name and 1000 for balance
You can add or subtract from a customer’s balance
Customer balances cannot go below 0
You can change a customer’s name
You can display a customer’s name and his or her balance
*/
/*
class Customer
{
double balance;
String customername;
Customer()
{
this.balance = 1000;
this.customername = "default customer";
}
public void createCustomer(String customername,double
balance)
{
if(balance==0)
{
this.balance = 1000;
}
else
this.balance = balance;
if(customername == "")
{
this.customername = "default customer";
}
else
this.customername = customername;
}
void addBalance(double balance)
{
this.balance += balance;
}
void subtractBalance(double balance)
{
if((this.balance == 0 ) || (this.balance - balance <= 0))
System.out.println("Customer Balance shouldn't 0 or lessthan
that");
else
this.balance -= balance;
}
public void changeCustomerName(String name)
{
this.customername = name;
}
public void showCustomer()
{
System.out.println("Customer Name : "+ customername);
System.out.println("Customer Balance : "+ balance);
}
}
*/
/*
You can create a new casino
All new casinos have a new casinoID assigned to them, starting with 1 for the first, 2 for the second, 3 for the third, ect.
New casinos have names and monetary balances
Default values are “default casino” for name and 50000 for balance
You can add or subtract from a casino’s balance
Casino balances cannot go below 0
Casinos offer 4 different games that customers can play
*/
//import java.util.*;
import java.util.Scanner;
import java.util.*;
class Casino
{
private int casinoID;
private String casinoName;
private double casinobalance;
double balance;
String customername;
Casino()
{
casinoID=0;
}
//Customer
public void createCustomer(String customername,double
balance)
{
if(balance==0)
{
this.balance = 1000;
}
else
this.balance = balance;
if(customername == "")
{
this.customername = "default customer";
}
else
this.customername = customername;
}
void addBalance(double balance)
{
this.balance += balance;
}
boolean subtractBalance(double balance)
{
boolean status =true;
if((this.balance == 0 ) || (this.balance - balance <= 0))
{
System.out.println("Customer Balance shouldn't 0 or lessthan
that");
status =false;
}
else
this.balance -= balance;
return status;
}
public void changeCustomerName(String name)
{
this.customername = name;
}
public void showCustomer()
{
System.out.println("Customer Name : "+ customername);
System.out.println("Customer Balance : "+ balance);
}
//Casino
public void createCasino(String casinoName,double
casinobalance)
{
casinoID = casinoID+1;
if(casinobalance==0)
{
this.casinobalance = 50000;
}
else
this.casinobalance = casinobalance;
if(casinoName == "")
{
this.casinoName = "default customer";
}
else
this.casinoName = casinoName;
}
void addcasinoBalance(double casinobalance)
{
this.casinobalance += casinobalance;
}
boolean subtractcasinoBalance(double casinobalance)
{
boolean status =true;
if((this.casinobalance == 0 ) || (this.casinobalance -
casinobalance <= 0))
{
System.out.println("Casino Balance shouldn't 0 or lessthan
that");
status = false;
}
else
this.casinobalance -= casinobalance;
return status;
}
public void changeCasinoName(String name)
{
if(subtractcasinoBalance(15000))
this.casinoName = name;
else
System.out.println("Insufficent funds to change casino
name");
}
void showGames()
{
System.out.println("Games List");
System.out.println("1) Twenty-one");
System.out.println("2) Slots");
System.out.println("3) High Low");
System.out.println("4) Seven-Eleven");
}
public void showCasinoDetails()
{
System.out.println("Casino ID : "+ casinoID);
System.out.println("Casino Name : "+ casinoName);
System.out.println("Casino Balance : "+ casinobalance);
}
public void playGame()
{
showGames();
System.out.println("Select Game :");
Scanner in = new Scanner(System.in);
int Option = in.nextInt();
switch(Option)
{
case 1:
System.out.println("Select Game :");
Scanner in1 = new Scanner(System.in);
int bet = in1.nextInt();
Random rand = new Random();
while(true)
{
int playerroll = rand.nextInt(11) + 1;
int casinoroll = rand.nextInt(11) + 1;
if((playerroll ==7 && casinoroll == 7) ||
(playerroll ==11 && casinoroll == 11) ||
(playerroll !=7 && casinoroll != 7) ||
(playerroll !=11 && casinoroll != 11))
{
continue;
}
if((playerroll == 7 || playerroll == 11) &&
(casinoroll !=7 && casinoroll != 11))
{
addBalance(bet);
subtractcasinoBalance(bet);
}
else if(playerroll == 7 && casinoroll == 11)
{
addcasinoBalance(bet);
subtractBalance(bet);
}
else if(playerroll ==11 && casinoroll == 7)
{
addBalance(bet);
subtractcasinoBalance(bet);
}
System.out.println("Player : "+ playerroll);
System.out.println("casino : "+ casinoroll);
break;
}
break;
case 2:
System.out.println("Number of Spins : ");
Scanner in2 = new Scanner(System.in);
int noofspins = in2.nextInt();
addcasinoBalance(noofspins*5);
if(subtractBalance(noofspins*5) == false)
{
System.out.println(" Insufficent Balance in customer... ");
break;
}
int count=0;
int[] intArray = {1,9,20,70};
while(count < noofspins)
{
int idx = new Random().nextInt(intArray.length);
int chance = intArray[idx];
int bal=0;
switch(chance)
{
case 1:
bal=1;
break;
case 9:
bal= 5;
break;
case 20:
bal= 10;
break;
case 70:
bal= 100;
break;
}
addBalance(bal);
subtractcasinoBalance(bal);
}
case 3: //sorry due lack of time i wasn't implement 3 and 4
System.out.println(" Game not supported... ");
break;
case 4:
System.out.println(" Game not supported... ");
break;
}
}
}
public class Application{
public static void main(String []args){
Casino obj=new Casino();
while (true){
System.out.println(" Casino System Application ");
System.out.println("1) Create a new customer ");
System.out.println("2) Create a new casino ");
System.out.println("3) Change a customer’s name ");
System.out.println("4) Change a casino’s name ");
System.out.println("5) Play games as a customer ");
System.out.println("6) Display customer details ");
System.out.println("7) Display casino details ");
System.out.println("Select Option : ");
Scanner in = new Scanner(System.in);
int choice = in.nextInt();
switch(choice)
{
case 1:
System.out.println("Enter Customer Name : ");
String custname= in.nextLine();
System.out.println("Enter Customer Balance : ");
double custbal = in.nextDouble();
obj.createCustomer(custname,custbal);
//obj.createCustomer("",0); // you can give user defined
break;
case 2:
System.out.println("Enter Casino Name : ");
String cname= in.nextLine();
System.out.println("Enter Casino Balance : ");
double cbal = in.nextDouble();
obj.createCasino(cname,cbal);
//obj.createCasino("",0); //default casion creation
break;
case 3:
System.out.println("Enter Customer Name : ");
String name= in.nextLine();
obj.changeCustomerName(name);
break;
case 4:
System.out.println("Enter Casion Name : ");
String name1= in.nextLine();
obj.changeCasinoName(name1);
break;
case 5:
obj.playGame();
break;
case 6:
obj.showCustomer();
break;
case 7:
obj.showCasinoDetails();
break;
case 8:
break;
}
}
}
}
Using Java You are helping a corporation create a new system for keeping track of casinos...
You are helping a corporation create a new system for keeping track of casinos and customers. The system will be able to record and modify customer and casino information. It will also be able to simulate games in the casino. You may complete this project individually or in a group of no more than 2 other people. Requirements do not change if you choose to complete the project individually or as part of a group. Customer-specific requirements You can create...
Using C++ Create a Blackjack program with the following features: Single player game against the dealer. Numbered cards count as the number they represent (example: 2 of any suit counts as 2) except the Aces which can count as either 1 or 11, at the discretion of the player holding the card. Face cards count as 10. Player starts with $500. Player places bet before being dealt a card in a new game. New game: Deal 2 cards to each...
Please write the program in python: 3. Design and implement a simulation of the game of volleyball. Normal volleyball is played like racquetball, in that a team can only score points when it is serving. Games are played to 15, but must be won by at least two points. 7. Craps is a dice game played at many casinos. A player rolls a pair of normal six-sided dice. If the initial roll is 2, 3, or 12, the player loses....
Create a simplified Blackjack game using the Deck and Card classes (download the attached files to start). There is also a "TestCard" class that creates a Deck and runs some simple code. You may choose to use this file to help you get started with your game program. 1) Deal 2 cards to the "player" and 2 cards to the "dealer". Print both the player's cards, print one of the dealer's cards. Print the total value of the player's hand. 2) Ask...
Create a Java text-based simulation that plays baccarat between two players. In baccarat, there is a banker and there is a player. Two cards are dealt to the banker and two cards to the player. Both cards in each hand are added together, and the objective (player) is to draw a two or three-card hand that totals closer to 9 than the banker. In baccarat, the card values are as follows: • 2–9 are worth face value • 10, J,...
You will write a two-class Java program that implements the Game of 21. This is a fairly simple game where a player plays against a “dealer”. The player will receive two and optionally three numbers. Each number is randomly generated in the range 1 to 11 inclusive (in notation: [1,11]). The player’s score is the sum of these numbers. The dealer will receive two random numbers, also in [1,11]. The player wins if its score is greater than the dealer’s...
For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------ ------ High 1 x Wager Low 1 x Wager Sevens 4 x...
Java Program Note: no break statements or switch staements High, Low, Sevens For this lab you will write a Java program that plays the dice game High-Low. In this game a player places a bet on whether the sum of two dice will come up High (totaling 8 or higher), Low (totaling 6 or less) or Sevens (totaling exactly 7). If the player wins, they receive a payout based on the schedule given in the table below: Choice Payout ------...
Java BlackJack Game:
Help with 1-4 using the provided code below
Source code for Project3.java:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class Project3 extends JFrame implements ActionListener
{
private static int winxpos = 0, winypos = 0; // place window
here
private JButton exitButton, hitButton, stayButton, dealButton,
newGameButton;
private CardList theDeck = null;
private JPanel northPanel;
private MyPanel centerPanel;
private static JFrame myFrame = null;
private CardList playerHand = new CardList(0);
private CardList dealerHand = new CardList(0);...
While using JAVA , solve this. There are three basic classes we'll need this week: Card: A class like the one presented in the modules, but with a few changes. Hand: A class that represents the cards held by a single player. Deck: A class that represents the source of the cards for dealing and, as the game progresses, the place from which players can receive new cards (say, as they pick cards "from the deck" or when future hands...