I. The \"Numbers\" G ame In recent years, many states have legalized various for
ID: 3683225 • Letter: I
Question
I. The "Numbers" G ame In recent years, many states have legalized various forms of gambling as a way to raise revenues. different types of lottery games, which are based on a traditional illegal game known as "the numbers" r "boleta." The most popular are In your basic numbers game, players make either a "Straight" bet or a "Box" bet with a 3-digit number combinat! n is chosen at random matches the winning number in any of the following ways, then the player wins the amount indicated, otherwise they lose The winning If the player's number Type of Bet If your Description number Winning Numbers Actual Payout Odds 1s: Exact order match $600 to 1 1 in 1000 Straight 546 546 Match Any Order (3 different numbers) Match Any Order 1 duplicate number) 546,564, 654,645, 456,465 S100 1 in 167 546 Box $200 1 in 919 199,919,991 Payouts shown are for the extinct, mob-run numbers game Strange, but the payouts in the legalized, state-run games (e.g "Cash 3") are substantially lower. Note that there is only 1 way to win a straight bet but 6 different ways to win a box bet with 3 different numbersExplanation / Answer
import java.util.*;
import java.util.Random;
class number_game
{
int bet_amt, play_no, win_no;
String bet_ty;
number_game(String bt, int bamt, int pno, int wno)
{
bet_ty=bt;
bet_amt=bamt;
play_no=pno;
win_no=wno;
}
int comp()
{
int a,a1,b,b1,c,c1;
if(bet_ty.equals("Straight bet"))
{
if(play_no==win_no)
{
return 600;
}
else
{
return 0;
}
}
else
{
a=play_no%10;
a1=win_no%10;
play_no=play_no/10;
win_no=win_no/10;
b=play_no%10;
b1=win_no%10;
play_no=play_no/10;
win_no=win_no/10;
c=play_no%10;
c1=win_no%10;
play_no=play_no/10;
win_no=win_no/10;
if((a==a1 && b==b1 && c==c1 ) || (a==b1 && b==a1 && c==c1) || (a==c1 && b==a1 && c==b1) )
return 200;
else
return 0;
}
}
}
class number_gametest
{
public static void main(String args[])
{
Scanner scan=new Scanner(System.in);
Random r = new Random();
System.out.println("Enter Bet type");
String bt=scan.nextLine();
System.out.println("Enter Bet amt");
int bamt=scan.nextInt();
System.out.println("Enter play number");
int pno=scan.nextInt();
int wno=r.nextInt(900)+100;
number_game o= new number_game(bt, bamt, pno, wno);
int wamt=o.comp();
System.out.println(bt+", $"+bamt+"player number "+pno+", winning number"+wno);
}
}