// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.util.Random;

import javax.swing.JOptionPane;

public class Guess {
   private static Random generator = new Random();
   private static int getNumber() {
      return generator.nextInt(10);
   }
   private static int getGuess() {
      return Integer.parseInt(JOptionPane.showInputDialog(null, "Enter number"));
   }
   public static void main(String[] args) {
      int number = getNumber();
      int guess = getGuess();
      if(number == guess) {
         JOptionPane.showMessageDialog(null, "Correct");
      } else {
         JOptionPane.showMessageDialog(null, "Wrong");
      }
   }
}
