Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
100%

I am trying to create a lottery game application in Java. I want it to generate three random numbers between 0 and 9 (including 0 and 9). Then, the user will input their three guesses of what the winning numbers will be. Next, compare each of the user's guesses to the three random numbers and display a message that includes the user's guess, the randomly determined three digits, and the amount of money the user has won. I need to make certain that this application accommodates repeating digits. For example, if a user guesses 1, 2, and 3, and the randomly generated digits are 1, 1, and 1, do not give the user credit for three correct guesses-just one. (From this, it stands to reason that if the randomly generated digits include 2 repeated digits, that they also should be counted as-just one.)

This is an example of the final output I am hoping to achieve with this program:

Guess the 3 numbers I have chosen.
Guess 1 right 10ドル
Guess 2 right 100ドル
Guess 3 right (any order) 1,000ドル
Guess 3 right (exact order) 1,000,000ドル
Enter the 1st number: 1
Enter the 2nd number: 4
Enter the 3rd number: 5
Computer picks: 1 2 3 You guessed: 1 4 5

1 Match, you win 10ドル

I want to try and identify ALL test cases. A test case will include the input necessary to create an expected output.

So far in my program, I have:

[画像:D2L ZyBooks Chapter 3 PA/CA/Lab X ← C onlinegdb.com/# SPONSOR Gitlab - Loved by developers. Trusted by enterprises. Start your free 30 day trial. X Run LotteryGameApplic... : 16 17 18 19 20 21 22 23 24 25 26 27 28 GDB online Debugger | Comp X D21 Homework Instructions - CSC ×ばつ b Home | bartleby Debug Stop Share 1 2 3 4- public class LotteryGameApplication{ 5 6- 7 8 9 10 11 12 13 14 15 H Save public static void main(String[] args) { //User enters three guesses System.out.println("Guess the three numbers I have chosen System.out.println("Guess 1 right System.out.println("Guess 2 right System.out.println("Guess 3 right (any order) System.out.println("Guess 3 right (exact order) System.out.println("Enter the 1st number: "); System.out.println("Enter the 2nd number: "); System.out.println("Enter the 3rd number: "); //Winnings final double ZeroDollars final double TenDollars final double Hundred Dollars 1000; final double Thousand Dollars final double AMillion Dollars = 1000000; input {} Beautify - 0; 10; - = 100; //Reveals Winning Lottery Numbers int min 0: x + between 0 and 9. "); 10ドル"); 100ドル"); 1000ドル"); 1,000,000ドル"); stderr Language Java C GI R PH 0ドル]
expand button
Transcribed Image Text:D2L ZyBooks Chapter 3 PA/CA/Lab X ← C onlinegdb.com/# SPONSOR Gitlab - Loved by developers. Trusted by enterprises. Start your free 30 day trial. X Run LotteryGameApplic... : 16 17 18 19 20 21 22 23 24 25 26 27 28 GDB online Debugger | Comp X D21 Homework Instructions - CSC ×ばつ b Home | bartleby Debug Stop Share 1 2 3 4- public class LotteryGameApplication{ 5 6- 7 8 9 10 11 12 13 14 15 H Save public static void main(String[] args) { //User enters three guesses System.out.println("Guess the three numbers I have chosen System.out.println("Guess 1 right System.out.println("Guess 2 right System.out.println("Guess 3 right (any order) System.out.println("Guess 3 right (exact order) System.out.println("Enter the 1st number: "); System.out.println("Enter the 2nd number: "); System.out.println("Enter the 3rd number: "); //Winnings final double ZeroDollars final double TenDollars final double Hundred Dollars 1000; final double Thousand Dollars final double AMillion Dollars = 1000000; input {} Beautify - 0; 10; - = 100; //Reveals Winning Lottery Numbers int min 0: x + between 0 and 9. "); 10ドル"); 100ドル"); 1000ドル"); 1,000,000ドル"); stderr Language Java C GI R PH 0ドル
[画像:D2L ZyBooks Chapter 3 PA/CA/Lab X ← C onlinegdb.com/# SPONSOR Gitlab - Loved by developers. Trusted by enterprises. Start your free 30 day trial. X 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 4.9 Run LotteryGameApplic... : Debug GDB online Debugger | Comp X D21 Homework Instructions - CSC ×ばつ b Home | bartleby final double TenDollars = 10; final double Hundred Dollars - } 100; final double Thousand Dollars = 1000; final double AMillion Dollars 1000000; //Reveals Winning Lottery Numbers int min int max Stop ✔ Share 0; 9; //Outputting User Winnings switch case 0: System.out.println("Computer Picks: " + Math.floor(Math.random() *(max - min + 1)+min ) + ", break; case 1: System.out.print("1 match, you win 10ドル!"); H Save break; case 2: System.out.print("2 matches, you win 100ドル!!"); {} Beautify break; case 3: System.out.print("Any 3 matches, you win 1,000ドル!!!"); break; System.out.print("EXACT 3 matches, you win 1,000,000ドル!!!! input x + stderr Language Java 11 GI R PH 0ドル +Math.floor(Math.random() *]
expand button
Transcribed Image Text:D2L ZyBooks Chapter 3 PA/CA/Lab X ← C onlinegdb.com/# SPONSOR Gitlab - Loved by developers. Trusted by enterprises. Start your free 30 day trial. X 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 4.9 Run LotteryGameApplic... : Debug GDB online Debugger | Comp X D21 Homework Instructions - CSC ×ばつ b Home | bartleby final double TenDollars = 10; final double Hundred Dollars - } 100; final double Thousand Dollars = 1000; final double AMillion Dollars 1000000; //Reveals Winning Lottery Numbers int min int max Stop ✔ Share 0; 9; //Outputting User Winnings switch case 0: System.out.println("Computer Picks: " + Math.floor(Math.random() *(max - min + 1)+min ) + ", break; case 1: System.out.print("1 match, you win 10ドル!"); H Save break; case 2: System.out.print("2 matches, you win 100ドル!!"); {} Beautify break; case 3: System.out.print("Any 3 matches, you win 1,000ドル!!!"); break; System.out.print("EXACT 3 matches, you win 1,000,000ドル!!!! input x + stderr Language Java 11 GI R PH 0ドル +Math.floor(Math.random() *
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
    Recommended textbooks for you
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education