Problem Statement: 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 and multiple games) and it is planning to add several more versions in the future. 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 or a VIP player. Each player keeps track of his/her own money and chips. A VIP player has a 4-digit id and name as well; the system also 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 when he or she leaves the game. A player can determine his/her winning amount when he or she leaves the game (include cash back credit if applicable).
The system will load all games with data from an input data file upon startup. The user (game operator) will be able to conduct one selected game at a time. The main menu should contain the following options:
Main Menu
1. Select a game
2. Add a player to the list
3. Quit
If option 1 is chosen, the user will be prompted to select a game from a list of available games and a game menu is available as shown below. When option 2 is selected, obtain necessary data and add a new player to the list of available players. When option 3 from the main menu is selected, print complete information for each game to a new text file before the program is terminated
Game Menu
1. Add a player to the game
2. Play one round
3. Return to the main menu
For option 1, you need to add the next player from a list of available players to the game. When option 2 is selected, play one round similar to project 2 and you need to exchange cash for chips for a player (if applicable), remove a player, and provide winning or losing information about the player that no longer wants to play. If option 3 is selected, return to the main menu.
See below for a sample input/output.
Initialize games. Please wait ...
All games are ready.
Available games: 100A1, 100A2
Main Menu
1. Select a game
2. Add a player to the list
3. Quit
Option --> 1
Select a game --> 100A1
Game Menu
1. Add a player to the game
2. Play one round
3. Return to main menu
. . .
Player 1 left the game with winning amount of $10
. . . .
Main Menu
1. Select a game
2. Add a player to the list
3. Quit Option --> 3
Generating report ...
Shutting down all games.
Sample report for one session (only one player with one round):
Game: 100A1
Initial Balance: $9500
Cash: $0 $100
chips: 50 $25
chips: 100
$5 chips: 200
$1 chips: 1000
Player 1 exchanges $100 for 2 $25-chip, 5 $5-chip, 25 $1-chip
Round 1 (Red 13)
Trans Player BAmount ($100 $25 $5 $1) BType Pay ($100 $25 $5 $1)
1 1 10 ( 0 0 2 0) R 20 ( 0 0 4 0)
Ending Balance: $9490
Cash: $100
$100 chips: 50
$25 chips: 98
$5 chips: 193
$1 chips: 975
Losing amount for this session: $10
There will be a data file, games.txt, contains information about the version, number of games, minimum bet, maximum bet, and available chips ($100, $25, $5, and $1). There will be another data file, players.txt, contains a list of available players, both regular players (N) and VIP players (Y). We will also make these assumptions as well:
Multiple games can be played and a game operator can switch back and forth between games.
Up to 4 players per game (seats 1 to 4).
Each buy-in (exchange cash for chips) is a multiple of $100. For each $100 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 $25 chip and 2 $5 chips).
A player starts with cash when entering a new game and can leave a game with chips.
A player can place multiple bets per round (up to 3).
Each game starts with 0 in cash for the casino
Assume there are sufficient chips for each game unless doing extra credit.
Players will get on the list to play and they will not get off the list.
The input data files contain valid data.
Implementation
Code your classes and write a roulette application by utilizing those classes. The program first loads data from games.txt, and players.txt. It then allows a game operator conducts each game and players to play the games. Print helpful messages to the screen so that we know what is going on. Make sure to utilize aggregation, inheritance, and polymorphism so that you will not need to do unnecessary work. Points will be deducted if you do not utilizing at least some useful OOP features.
You might not be able to implement all features, but here is the order of important features:
1. Keep track of chips
2. Allow VIP players
3. Generate a summary report without transactions (ignore transactions)
4. Allow multiple bets per round for each player (can start with one bet)
5. Support multiple games (can start with one game)
6. Keep track of transactions and include transactions in report
7. Add a new player to the list of available players
these are the classes i used in project 2
and they are all in Java.
also two text files were given.
GamesMulModels.txt
100A 2
1 20 50 100 200 1000
5 100 100 200 500 1000
100B 3
1 10 50 100 200 1000
5 100 50 100 500 2000
2 20 10 20 50 100
and
players.txt
N 100
Y 500 1234 Jane Smith
Y 300 3455 John Smith
N 500
Y 1000 9867 Hot Shot
N 200
N 300
*/
//************************************************************************
// Class Wheel represents a roulette wheel and its operations. Its
// data and methods are static because there is only one wheel.
//************************************************************************
public class Wheel
{
// public name constants -- accessible to others
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 = 36; // largest number to bet
// private name constants -- internal use only
private final static int MAX_POSITIONS = 38; // number of positions on wheel
private final static int NUMBER_PAYOFF = 35; // 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 .. 36
private static int color; // GREEN, RED, OR BLACK
//=====================================================================
// Presents welcome message
//=====================================================================
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 + " the bet amount.");
System.out.println("A number bet is paid " + NUMBER_PAYOFF + " the bet amount.");
System.out.println("Have fun and good luck!\n");
}
//=====================================================================
// Presents betting options
//=====================================================================
public static void betOptions()
{
System.out.println("Betting Options:");
System.out.println(" 1. Bet on black");
System.out.println(" 2. Bet on red");
System.out.println(" 3. Bet on a number between " + MIN_NUM +
" and " + MAX_NUM);
System.out.println();
}
//=====================================================================
// method spins the wheel
//=====================================================================
public int spin()
{
ballPosition= (int)(Math.random() * MAX_POSITIONS + 1);;
if(ballPosition < 37)
{
if(ballPosition % 2 == 0)
{
color = BLACK;
}
else
{
color = RED;
}
}
else
{
color = GREEN;
}
System.out.print("the Result is: "+ ballPosition
+ " and color is: ");
if (color == BLACK)
{
System.out.println("BLACK.");
}
else if (color == RED)
{
System.out.println("RED.");
}
else
{
System.out.println("GREEN.");
}
return ballPosition;
}
//=====================================================================
// calculates the payoff
//=====================================================================
public int payoff( int bet, int betType, int number)
{
if (color == GREEN)
{
return 0;
}
else if (betType == 1 && color == BLACK)
{
return bet * COLOR_PAYOFF;
}
else if (betType == 2 && color == RED)
{
return bet * COLOR_PAYOFF;
}
else if (betType == 3 && number == ballPosition)
{
return bet * NUMBER_PAYOFF;
} else return 0;
}
}
import java.util.Scanner;
//************************************************************************
// Class Player represents one roulette player.
//************************************************************************
public class Player
{
private int bet, money, betType, number, betNet;
@SuppressWarnings("unused")
private static int houseWins;
private String name;
private Scanner scan = new Scanner(System.in);
//=====================================================================
// The Player constructor sets up name and initial available
money.
//=====================================================================
public Player (String playerName, int initialMoney)
{
name = playerName;
money = initialMoney;
} // constructor Player
//=====================================================================
// Returns this player's name.
//=====================================================================
public String getName()
{
return name;
} // method getName
//=====================================================================
// Returns this player's current available money.
//=====================================================================
public int getMoney()
{
return money;
} // method getMoney
//=====================================================================
// returns the net bets for that player
//=====================================================================
public int getNet()
{
return betNet;
}
//=====================================================================
// Prompts the user and reads betting information.
//=====================================================================
@SuppressWarnings("static-access")
public void makeBet(Wheel Wheel)
{
Scanner scan = new Scanner(System.in);
System.out.print("How much do you want to bet " + name
+ "? : ");
bet = scan.nextInt();
if(bet>=money)
{
System.out.println("im going all in!");
bet= money;
money = money-bet;
}
else
{
money =
money-bet;
}
Wheel.betOptions();
System.out.println("Choose your bet type: ");
betType = scan.nextInt();
if(betType == 3){
System.out.println("your'e betting on: a
number");
while(true){
System.out.println("Please enter the number you "
+ "wish to bet on from 1 to
36: ");
number = scan.nextInt();
if(number <1 || number > 36)
{
System.out.println("This Number is not in "
+ "the desired
range.");
}
else
{
break;
}
}
}
}
// method makeBet
//=====================================================================
// Determines if the player wants to play again.
//=====================================================================
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"));
}
// method playAgain
public void payment(Wheel Wheel2)
{
int winnings = Wheel2.payoff(bet, betType,
number);
money += winnings;
if(winnings > 0)
{
betNet += (winnings-bet);
Roulette.setHouseWins(-(winnings-bet));
}
else
{
betNet -= bet;
Roulette.setHouseWins((bet));
}
// =========================================================
// if player runs out of money.
// =========================================================
if(money < 1)
{
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();
if(answer.equals("y") || answer.equals("Y"))
{
if (betNet>-200)
{
System.out.println("You bought back in for 100");
money +=100;
}
else {
System.out.println("Sorry buddy,
your cutt off from the credit line.");
money = 0;
}
}
}
//setHouseWins(betNet);
System.out.println(" Testing to see how much is "
+ "betNet keeping track of: " +
betNet);
}
}
import java.util.*;
//************************************************************************
// Class Roulette contains the main driver for a roulette betting
game.
//************************************************************************
public class Roulette
{
private static int houseMoney=0;
//=====================================================================
// Contains the main processing loop for the roulette game.
//=====================================================================
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
String name1 = "jane"; String name2 = "don";
Wheel wl1 = new Wheel();
System.out.println("please enter a name for player 1:
");
name1 = scan.nextLine();
System.out.println("please enter a name for player 2:
");
name2 = scan.nextLine();
Player player1 = new Player (name1, 100); // $100 to
start for Jane
Player player2 = new Player (name2, 100); // $100 to
start for Dave
boolean bl1 = true;
boolean bl2 = true;
Wheel.welcomeMessage();
while (bl1 || bl2)
{
System.out.println ("Money available for " +
player1.getName()
+ ": " + player1.getMoney());
if(bl1)player1.makeBet(wl1);
System.out.println ("Money available for " +
player2.getName()
+ ": " + player2.getMoney());
if(bl2)player2.makeBet(wl1);
wl1.spin();
if(bl1 == true)
{
//initiate the payment
player1.payment(wl1);
System.out.println ("Money available for " + player1.getName() +
": "
+ player1.getMoney());
// check weather play the game again
if(!player1.playAgain(scan))
{
bl1 = false;
System.out.println(player1.getName()+" total wins/losses:
"
+ player1.getNet());
}
}
// check the boolean value
if(bl2 == true)
{
//initiate the payment
player2.payment(wl1);
System.out.println ("Money available for " +
player2.getName() + ": " +
player2.getMoney());
// check weather play the game again
if(!player2.playAgain(scan))
{
bl2 = false;
System.out.println(player2.getName()+ " total wins/losses:
"
+ player2.getNet());
}
}
}
System.out.println();
System.out.printf("House %s: $%d", houseMoney > 0 ? "Wins" : "Losses", houseMoney);
System.out.println();
System.out.println ("Game over! Thanks for playing.");
}
public static void setHouseWins(int Winnings)
{
houseMoney += Winnings;
}
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Problem Statement: A company intends to offer various versions of roulette game and it wants you...
Java Listed below is code to play a guessing game. In the game, two players attempt to guess a number. Your task is to extend the program with objects that represent either a human player or a computer player. boolean checkForWin (int guess, int answer) { System.out.println("You guessed" + guess +"."); if (answer == guess) { System.out.println( "You're right! You win!") ; return true; } else if (answer < guess) System.out.println ("Your guess is too high.") ; else System.out.println ("Your...
This is my code for my game called Reversi, I need to you to make the Tester program that will run and complete the game. Below is my code, please add comments and Javadoc. Thank you. public class Cell { // Displays 'B' for the black disk player. public static final char BLACK = 'B'; // Displays 'W' for the white disk player. public static final char WHITE = 'W'; // Displays '*' for the possible moves available. public static...
in java coorect this code & screenshoot your output ---------------------------------------------------------------------- public class UNOGame { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input=new Scanner(System.in); Scanner input2=new Scanner(System.in); UNOCard c=new UNOCard (); UNOCard D=new UNOCard (); Queue Q=new Queue(); listplayer ll=new listplayer(); System.out.println("Enter Players Name :\n Click STOP To Start Game.."); String Name = input.nextLine();...
Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...
Modify the program that you wrote for the last exercise in a file named Baseball9.java that uses the Player class stored within an array. The program should read data from the file baseball.txt for input. The Player class should once again be stored in a file named Player.java, however Baseball9.java is the only file that you need to modify for this assignment. Once all of the input data from the file is stored in the array, code and invoke a...
Project 7-3 Guessing Game import java.util.Scanner; public class GuessNumberApp { public static void main(String[] args) { displayWelcomeMessage(); // create the Scanner object Scanner sc = new Scanner(System.in); String choice = "y"; while (choice.equalsIgnoreCase("y")) { // generate the random number and invite user to guess it int number = getRandomNumber(); displayPleaseGuessMessage(); // continue until the user guesses the number int guessNumber = 0; int counter = 1; while (guessNumber != number) { // get a valid int from user guessNumber...
Question 12 5 pts Roulette is a game involving a wheel that contains numbers 1 through 36 along with O and 00. Eighteen numbers are red and eighteen numbers are black. The 0 and 00 are green. Players can place a bet on any of the numbers, specified ranges or the color of the number. A ball is then dropped onto the spinning wheel and the ball comes to rest on one of the 38 spots on the wheel. A...
I have already finished most of this assignment. I just need some help with the canMove and main methods; pseudocode is also acceptable. Also, the programming language is java. Crickets and Grasshoppers is a simple two player game played on a strip of n spaces. Each space can be empty or have a piece. The first player plays as the cricket pieces and the other plays as grasshoppers and the turns alternate. We’ll represent crickets as C and grasshoppers as...
I need help with this method (public static int computer_move(int board[][])) . When I run it and play the compute.The computer enters the 'O' in a location that the user has all ready enter it sometimes. I need to fix it where the computer enters the 'O' in a location the user has not enter the "X' already package tictactoe; import java.util.Scanner; public class TicTacToeGame { static final int EMPTY = 0; static final int NONE = 0; static final...
Make a FLOWCHART for the following JAVA Prime Number Guessing Game. import java.util.Random; import java.util.Scanner; public class Project2 { //Creating an random class object static Random r = new Random(); public static void main(String[] args) { char compAns,userAns,ans; int cntUser=0,cntComp=0; /* * Creating an Scanner class object which is used to get the inputs * entered by the user */ Scanner sc = new Scanner(System.in); System.out.println("*************************************"); System.out.println("Prime Number Guessing Game"); System.out.println("Y = Yes , N = No...