Question: Modify codes to meet problem statement requirements: A company intends to offer various versions of roulette game and it wants you to develop a customized

Modify codes to meet problem statement requirements:

A company intends to offer various versions of roulette game and it wants you to develop a customized object-oriented software solution. This company plans to offer one version 100A now (similar to the simple version in project 2 so refer to it for basic requirements, but it allows multiple players per game (up to 5) and multiple games (up to 5) and there are now 38 positions on the wheel: 00, 0, 1 to 36, and the payoff for a number bet is 35 to 1) and it is planning to add several more versions in the future with more betting options. Each game has a minimum and maximum bet and it shall be able to keep track of its id, chips, money, active players, and transactions. Available chips for each game shall consist of $1, $5, $25, and $100. Each transaction shall consist of a transaction number, player number (seat number), and relevant betting information. A player can be a regular player, a VIP player, or a super VIP player. Each player keeps track of his/her own money and chips. Both types of VIP players have a 4-digit id and name as well. The system keeps track of all bets and awards 5% cash back credit rounding up to a whole dollar of all the bets to a VIP player after he or she leaves the game. In addition to getting back 5% cash back credit like a VIP player, a super VIP player gets a bonus amount based on the number of bets after he or she leaves the game ($20 for at least 10 bets and up to 20 bets, $50 for more than 20 bets). A player can determine his/her winning amount when he or she leaves the game (include cash back credit if applicable).

You can make the following assumptions:

Modify codes to meet problem statement requirements: A company intends to offer

Read from data files:

games.txt

100A 2

1 20 50 100 200 1000

5 100 100 200 500 1000

players.txt

0 100

1 500 1234 Jane Smith

1 300 3455 John Smith

0 500

2 1000 9867 Hot Shot

0 200

0 300

2 2000 5555 Charles B

CODES:

/* Player.java */

import java.util.*;

class Player

{

private int bet, money, betType, betNumber, betNet;

private static int houseWins;

private String name;

private Scanner scan = new Scanner(System.in);

public Player (String playerName, int initialMoney) // contructor, set name and initial $

{

name = playerName;

money = initialMoney;

}

public String getName()

{

return name;

}

public int getMoney()

{

return money;

}

public int getNet()

{

return betNet;

}

public void makeBet(Wheel wheel) // prompt and bet info

{

System.out.print("How much to bet for " + name + ": ");

bet = scan.nextInt();

if(bet >= money)

{

bet = money;

System.out.println("Player declares ALL IN! ");

}

money -= bet;

wheel.betOptions();

betType = scan.nextInt();

if(betType == 3)

{

while(true)

{

System.out.println("Please enter the number you wish to bet on from 00 to 10: ");

betNumber = scan.nextInt();

if(betNumber 10)

{

System.out.println("This number is not in the desired range.");

}

else

{

break;

}

}

}

}

public boolean playAgain(Scanner scan)

{

String answer;

System.out.println (name + " Play again [Y/N]? ");

answer = scan.nextLine();

return (answer.equals("y") || answer.equals("Y"));

}

public void payment(Wheel wheel2)

{

int earnings = wheel2.Payoff(bet, betType, betNumber);

money += earnings;

if(earnings > 0)

{

betNet += (earnings-bet);

Roulette.setHouseWins(-(earnings-bet));

}

else

{

betNet -= bet;

Roulette.setHouseWins((bet));

}

if(money

{

Scanner scan = new Scanner(System.in);

System.out.println(name + ", you're out of money. Do you want to bet more? [Y/N] ");

String answer= scan.nextLine().toLowerCase();

if(answer.equals("y"))

{

money += 100;

}

}

}

}

/* Wheel.java */

class Wheel

{

public final static int BLACK = 0; // even numbers

public final static int RED = 1; // odd numbers

public final static int GREEN = 2; // 00 OR 0

public final static int NUMBER = 3; // number bet

public final static int MIN_NUM = 1; // smallest number to bet

public final static int MAX_NUM = 10; // largest number to bet

// private name constants -- internal use only

private final static int MAX_POSITIONS = 12; // number of positions on wheel

private final static int NUMBER_PAYOFF = 10; // payoff for number bet

private final static int COLOR_PAYOFF = 2; // payoff for color bet

// private variables -- internal use only

private static int ballPosition; // 00, 0, 1.. 10

private static int color; // GREEN, RED, OR BLACK

public static void welcomeMessage()

{

System.out.println("Welcome to a simple version of roulette game.");

System.out.println("You can place a bet on black, red, or a number.");

System.out.println("A color bet is paid " + COLOR_PAYOFF + " times the bet amount.");

System.out.println("A number bet is paid " + NUMBER_PAYOFF + " times the bet amount.");

System.out.println("Good luck, have fun!!! ");

}

public static void betOptions()

{

System.out.println("Betting Options:");

System.out.println(" 1. Black");

System.out.println(" 2. Red");

System.out.println(" 3. Number between " + 0 + (MIN_NUM - 1) + " and " + MAX_NUM);

System.out.println();

}

public int Spin()

{

ballPosition = (int)(Math.random() * 12 + 1);

if(ballPosition

{

if(ballPosition % 2 == 0)

{

color = BLACK;

}

else

{

color = RED;

}

}

else

{

color = GREEN;

}

if (ballPosition == 10)

{

System.out.println("Result: "+ ((color

}

else

{

System.out.println("Result: "+ ((color

}

return ballPosition;

}

public int Payoff(int betAmount, int betType, int betNumber)

{

if(color == GREEN)

{

return 0;

}

else if (betType == 1 && color == BLACK)

{

return betAmount * COLOR_PAYOFF;

}

else if ( betType == 2 && color == RED)

{

return betAmount * COLOR_PAYOFF;

}

else if (betType == 3 && betNumber == ballPosition)

{

return betAmount * NUMBER_PAYOFF;

}

else

{

return 0;

}

}

}

/* Roulette.java */

import java.util.*;

class Roulette

{

private static int houseMoney = 0;

public static void main (String[] args)

{

Wheel wheely = new Wheel(); // construct wheel class object

Scanner scan = new Scanner(System.in);

Player pl1 = new Player ("Sydney", 100); // players

Player pl2 = new Player("Justin", 100);

Player pl3 = new Player("Ariel", 100);

boolean bool1 = true; // end checks

boolean bool2 = true;

boolean bool3 = true;

Wheel.welcomeMessage();

while (bool1 || bool2 || bool3)

{

if(bool1)pl1.makeBet(wheely);

if(bool2)pl2.makeBet(wheely);

if(bool3)pl3.makeBet(wheely);

wheely.Spin();

if(bool1)

{

pl1.payment(wheely);

System.out.println ("Money available for " + pl1.getName() + ": " + pl1.getMoney());

if(!pl1.playAgain(scan))

{

bool1 = false;

System.out.println(pl1.getName()+ " total wins/losses: " + pl1.getNet());

}

}

if(bool2)

{

pl2.payment(wheely);

System.out.println ("Money available for " + pl2.getName() + ": " + pl2.getMoney());

if(!pl2.playAgain(scan))

{

bool2 = false;

System.out.println(pl2.getName()+ " total wins/losses: " + pl2.getNet());

}

}

if(bool3)

{

pl3.payment(wheely);

System.out.println ("Money available for " + pl3.getName() + ": " + pl3.getMoney());

if(!pl3.playAgain(scan))

{

bool3 = false;

System.out.println(pl3.getName()+ " total wins/losses: " + pl3.getNet());

}

}

System.out.println();

}

System.out.printf("Casino %s: $%d", houseMoney > 0 ? "Profits" : "Losses", houseMoney);

System.out.println();

System.out.println ("Game over! Thanks for playing.");

}

public static void setHouseWins(int earnings)

{

houseMoney += earnings;

}

}

SAMPLE OUTPUT:

various versions of roulette game and it wants you to develop a

SAMPLE REPORT:

customized object-oriented software solution. This company plans to offer one version 100A

Multiple games can be played and a game operator can switch back and forth between games. Up to 5 players per game (seats 1 to 5). A player can only play one game at a time. Each buy-in (exchange cash for chips) is a multiple of $100. For each S100 buy-in, a player would get 2 $25 chips, 5 $5 chips, and 5 $1 chips. A winning bet will be paid with largest denomination first (e.g., a winning bet of $35 would get 1 S25 chip and 2 $5 chips). A player starts with cash when entering a new game and can leave a game with chips and A player can place multiple bets per round (up to 3) game starts with 0 in cash for the casino e there are sufficient chips for each game u Each Assum Players will get on the list to play and they will not get off the list, but they may not be available when being called to the game. nless doing extra credit. .The input data files contain valid data. Multiple games can be played and a game operator can switch back and forth between games. Up to 5 players per game (seats 1 to 5). A player can only play one game at a time. Each buy-in (exchange cash for chips) is a multiple of $100. For each S100 buy-in, a player would get 2 $25 chips, 5 $5 chips, and 5 $1 chips. A winning bet will be paid with largest denomination first (e.g., a winning bet of $35 would get 1 S25 chip and 2 $5 chips). A player starts with cash when entering a new game and can leave a game with chips and A player can place multiple bets per round (up to 3) game starts with 0 in cash for the casino e there are sufficient chips for each game u Each Assum Players will get on the list to play and they will not get off the list, but they may not be available when being called to the game. nless doing extra credit. .The input data files contain valid data

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!