Question: Using inner class, simulate a lottery game(pega4): The program must keep running until one of two situations occur: 1. Press 'OK' from JOptionPane ( if

Using inner class, simulate a lottery game("pega4"):
The program must keep running until one of two situations occur:
1. Press 'OK' from JOptionPane ( if button is pressed, display: You Lose!)
2. If the number entered matches the number generated by the program, display: You Win!.
Also you must implement an interface called ask(). The interface asks the user's desired number
The interval for each 'throw' of numbers in the game must be of 1 second and must make a beep for each thrown number, you must show how many numbers where thrown.
Note: You must investigate how to generate a random number. Remember that "pega4" goes from 1000 to 9999.
The output should be as follows:
Asig5 - Pega4 (Due 01/23) Utilizando inner class discutido en clase, simular que estas jugando Pega4: El programa debe continuar corriendo hasta que ocurra una de estas dos situaciones: 1. Presionar Ok del JOptionPane (si presionas el boton debe decir "Perdiste !!!"). 2. Si el numero entrado sale en el Pega4, debe decir Ganaste! Deben implementar una interface llamada ask(). El cual preguntara el numero deseado. El intervalo que sea cada 1 segundo y que haga un "beep". Que muestre cuantas tiradas se hicieron. Nota: Investigar como generar numeros al azar. Recuerdar que Pega4 va desde 1000 hasta 9999. El output seria como sigue: Entrar nmero deseado: 3267 09/07/2019 09:50:23: tirada #1: 4392 tirada #2: 8391 Perdiste !!! Entrar nmero deseado: 4912 09/07/2019 09:50:23: tirada #1: 4931 tirada #2: 9450 tirada #3: 4912 Ganaste
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
