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

import java.util.*; public class Casino { public static void main (String[] args

ID: 3660053 • Letter: I

Question

import java.util.*; public class Casino { public static void main (String[] args) { Scanner console = new Scanner (System.in); double wallet = 100.00; //Start the user off with $100 double bet = 0.00; //User bet double result = 0.00; //To store the winnings/losses of each game String input = ""; //User input //Create instance of the Roulette game (that you're creating) Roulette game = new Roulette(); do { System.out.println("How much would you like to bet?"); bet = console.nextDouble(); wallet = wallet - bet; //Play a round and store the results result = game.betOnce(bet); //Flush the buffer console.nextLine(); //Update wallet amount and notify user wallet = wallet + result; System.out.println("You have $" + wallet + " in your wallet."); System.out.println("Bet again? Y or N?"); input = console.nextLine(); } while (!input.equalsIgnoreCase("N")); } //end main } //end class

Explanation / Answer

---------------------Integrate the program into the your-Casino system..similar one and also good one----------------- import java.awt.*; public class Roulette { public static void main(String[] args) { new Roulette(); } Label lMoney = addLabel("Money",40,40,60,30,this); TextField tMoney = addTextField("",100,40,100,30,this); Button bBet = addButton("Bet",40,70,80,30,this); Button bSpin = addButton("Spin",120,70,80,30,this); TextField tBet = addTextField("",40,100,80,40,this); TextField tChoice = addTextField("",40,140,80,40,this); TextField tNumber = addTextField("",120,100,80,80,this); int money = 1000; int bet = 0; int betting = 0; String choice = ""; public void actions(Object source,String command) { if(source == bBet) { makeBet(); } else if (source == bSpin) { spin(); } } public Roulette() { setTitle("Raging Roulette"); setSize(250,200); setBackground(Color.green); tNumber.setFont(new Font("Arial",0,50)); tNumber.setForeground(Color.white); tNumber.setBackground(Color.green); tBet.setFont(new Font("Arial",0,30)); tChoice.setFont(new Font("Arial",0,30)); tMoney.setFont(new Font("Arial",0,16)); tMoney.setText(money + ""); } public void makeBet() { do { betting = inputInt("How much do you want to bet?"); } while (betting < 0 || betting > money); bet = betting; choice = input("Betting on : Red, Black, or a Number"); tBet.setText(betting + ""); tChoice.setText(choice); } public int rand(int lowest, int highest) { return (int)(Math.floor(Math.random()*(highest-lowest+1)+lowest)); } public void spin() { long start = System.currentTimeMillis(); do { int num = rand(0,36); tNumber.setText( num + ""); if (num == 0) { tNumber.setBackground(Color.green); } else if ( ((num-1)/3) % 2 == 0 ) { tNumber.setBackground(Color.red); } else { tNumber.setBackground(Color.black); } repaint(); } while (System.currentTimeMillis()-start < 3000); money = money + checkWinner(); tMoney.setText(money + ""); } public int checkWinner() { if ((tNumber.getBackground() == Color.red) && (tChoice.getText().equals("Red"))) { return bet; } else if ((tNumber.getBackground() == Color.black) && (tChoice.getText().equals("Black"))) { return bet; } else if (tNumber.getText().equals( tChoice.getText() ) ) { return 36*bet; } else { return -bet; } } public void pause(long millis) { long start = System.currentTimeMillis(); do { } while (System.currentTimeMillis() - start