Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are helping a corporation create a new system for keeping track of casinos a

ID: 3714059 • Letter: Y

Question

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 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

Explanation / Answer

Solution:

//Applicaation

/*

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;
}
  
}
  
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote