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:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Ⓒ
GI
Ⓡ
PH
€0
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 Ⓒ GI Ⓡ 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
Ⓡ
PH
€0
+Math.floor(Math.random() *
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 Ⓡ PH €0 +Math.floor(Math.random() *
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Returning value from Function
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education