Advertisement
JoshHZR

Programa

Dec 2nd, 2017
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. import javax.swing.JOptionPane;
  2. public class Programa {
  3. public static void main(String[] args) {
  4.   for (int i=1; i<=10; i++) {
  5.     Tablas operacion=new Tablas();
  6.  
  7.  
  8.     int pregunta = Integer.parseInt(JOptionPane.showInputDialog(null, operacion.getNumeroPregunta()+"\n"+operacion.multiplicacion()));
  9.         if (pregunta == operacion.resultado()) {
  10.             Tablas.comprobadorPreguntas(true);
  11.         }
  12.         else {
  13.             do {
  14.             String salida="";
  15.             for (i=1; i<=10; i++) {
  16.                 salida+=operacion.getMultiplicando() + "x"+i+"=" + (operacion.getMultiplicando() * i) + "\n";
  17.             }
  18.             JOptionPane.showMessageDialog(null, salida);
  19.             pregunta = Integer.parseInt(JOptionPane.showInputDialog(null, operacion.getNumeroPregunta()+"\n"+operacion.multiplicacion()));
  20.         } while(pregunta != operacion.resultado());
  21.             Tablas.comprobadorPreguntas(false);
  22.     }
  23.     }
  24.  
  25.     JOptionPane.showMessageDialog( null, "Preguntas acertadas a la primera: "+Tablas.getContador());
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement