Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a simple GUI Java program that will test the memory of a user. The progra

ID: 3622267 • Letter: I

Question

I need a simple GUI Java program that will test the memory of a user. The program should show a dialog box with some numbers to be memorized: 5, 4, 9, 8,1. This initial dialog box should say,

“This Program will test you memory skills. Memorize the following numbers: 5,4,9,8,1”
They then have to hit “ok” button to continue.
The user is then asked to enter the numbers in a new box for every number with a message like “Enter 1st number” “Enter 2nd number” and so forth.

If they get any one number wrong, the program immediately prints a “You got it wrong message”.
If the user gets all numbers correct, the program prints out a “Great job!!” message.

Avoid hard fixed number values in the interior of the program. Values should be declared one at a time in an array at the top of the program.
***This Java program should contain a class named myprog1
***Simple FlowLayout manager scheme needs to be used.
***Need an inner class for the listner

PLEASE EMAIL ME WITH ANY QUESTIONS TO THE PROGRAM

Explanation / Answer

import javax.swing.JOptionPane; public class myprog1 { public static void main(String[] args) { int number1,number2,number3,number4,number5; String input; JOptionPane.showMessageDialog(null, " 5, 4, 9, 8, 1 "); input = JOptionPane.showInputDialog("Enter first Number : " ); number1 = Integer.parseInt(input); if(number1 == 5) { JOptionPane.showMessageDialog(null, "Great job "); } else JOptionPane.showMessageDialog(null, "You got it wrong message"); input = JOptionPane.showInputDialog("Enter second Number : " ); number2 = Integer.parseInt(input); if(number2 == 4) { JOptionPane.showMessageDialog(null, "Great job "); } else JOptionPane.showMessageDialog(null, "You got it wrong message"); input = JOptionPane.showInputDialog("Enter third Number : " ); number3 = Integer.parseInt(input); if(number3 == 9) { JOptionPane.showMessageDialog(null, "Great job "); } else JOptionPane.showMessageDialog(null, "You got it wrong message"); input = JOptionPane.showInputDialog("Enter fourth Number : " ); number4 = Integer.parseInt(input); if(number4 == 8) { JOptionPane.showMessageDialog(null, "Great job "); } else JOptionPane.showMessageDialog(null, "You got it wrong message"); input = JOptionPane.showInputDialog("Enter fifth Number : " ); number5 = Integer.parseInt(input); if(number5 == 1) { JOptionPane.showMessageDialog(null, "Great job "); } else JOptionPane.showMessageDialog(null, "You got it wrong message"); System.exit(0); } } I hope this will helps to You !

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote