Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with this Java program. I. The Numbers Game At last count, 48 states have legalized various forms of gambling as a way to raise

Help with this Java program.

image text in transcribedimage text in transcribedimage text in transcribed

I. The "Numbers" Game At last count, 48 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 gameknown as "the numbers"or "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. combination 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 If Yourwinning Type of Bet Actual odds Description number Payout Numbers Exact order match $600 to 1 1 in 1000 Straight 546 546 Match Any Order (3 different numbers) 546,564 654,645, 456,465 $100 to 1 1 in 167 546 Box Match Any Order (1 duplicate number) $200 1 in 919 199,919,991 Payouts shown are for the extinct, mob-run numbers game Naturally, the payouts in the legalized, state-run games (e.q "Cash 3") are substantially lower Note that there is only 1 way to win a straight bet but 6 ways to win a box bet without duplicate numbers and 3 ways to win a box bet with duplicate numbers This assignment is to create a class to simulate the number:s game II. Numbers Game Class Specifications Your class will have 4 instancevariables: bet type bet amount player' s number Winning number and a constructor to initialize them to values passed by the user. You may also have any additional instance variables you Tind necessary or useful For full credit,theplaver's number and the winning number should both be 3-digit ints. Not .3 separateintS. converting to strinas and usina the substrin me thod to get each aidit NotStrings Andnofair HINT: Use the int division and mod operations to et the indiviaial aigitS Your class will also have two additional methods: 1. a method that returns the input data as a string 2. a method that compares the player' s number to the winning number and returns the amount won (or 0 if the player loses) III. Test Class Specifications All data - bet type, bet amount, player' s number, and winning number- are to be entered by the user Assume that neither number will begin with zero Output must include all the input values and must be neatly presented All output is to be done in the test class None of the methods of the NumbersGame class do any output IV, Program Testing Test your programthoroughly and exhaustively before submitting it. Hint: There is only 1 way to win a Straight Bet, but there are 6 ways to win a Box Bet without duplicates and 3 ways to win a Box Bet with duplicates. Test them all. V. Algorithm Here is a high-level algorithm for the method that evaluates the player's bet: if straight bet) f (all three numbers match in exact order) player wins $600 for each $1 wagered else plaver Joses else // Box bet if (all three numbers match in any order) // player wins if (player's number contains duplicates) player wins $200 for each $1 wagered else// no duplicates player wins $100 for each $1 wagered else player loses

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Differentiate between earned and unearned privilege

Answered: 1 week ago

Question

=+ (b) Show that no record stands forever.

Answered: 1 week ago