Play10 Lottery Game: That simulates a lottery game that generates a random integer between 1 and 10, and then allows the user to purchase lottery tickets for $2.00 a piece to try and win money if the purchased tickets’ integer match the winning integer. The odds of winning are 1:9 (winning outcomes to losing outcomes). The probability of winning is expressed as 1/10 (1 winner in 10 outcomes), so a $2.00 ticket that matches the winning integer will receive a fair payout of $20.00. Create a Java application in NetBeans called "Lab05" that asks the user how many tickets will be purchased, confirms the credit card charges for the tickets, and then asks if the user wants to have the computer generate the guesses between 1 and 10. If so, the program should use the following formula to generate the random guesses and the random winning integer: random Integer = min + (int) (Math.random() * ((max - min) + 1)). In this case, the min is 1, and the max is 10. Otherwise, the program asks the user to enter the guesses. Once done, compare the guesses to the winning integer, and accumulate the total winnings and losings and report the tickets that are winners. The ticket price must be declared as a constant, set to $2.00, in your program. You can accumulate this ticket information to a String output variable inside a for loop, and then print the output variable after completing the for loop. Report the total winnings, the remaining balance after subtracting credit card charges, and the amount that you can deduct from your taxes. The allowable tax deduction is the total amount of your losses up to the amount of your winnings (i.e. the minimum of your total winnings and total losses). Study the sample runs below, and note the checking of the inputted data for errors.

Solved
Show answers

Ask an AI advisor a question