Advertisement
JoshHZR

Métodos

Dec 2nd, 2017
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. public class Tablas {
  2.         private final int multiplicador;
  3.         private final int multiplicando;
  4.         private static int contador=0;
  5.         private static int numeroPregunta=0;
  6.  
  7.  
  8.         public Tablas(){
  9.             multiplicador=(int) (Math.random() * 10) + 1;
  10.             multiplicando=(int) (Math.random() * 10) + 1;
  11.             numeroPregunta++;
  12.         }
  13.  
  14.  
  15.  
  16.  
  17.         public String multiplicacion(){
  18.             String salida=getMultiplicando()+"x"+getMultiplicador()+"=";
  19.             return salida;
  20.         }
  21.  
  22.  
  23.         public int resultado(){
  24.             int salida=getMultiplicando()*getMultiplicador();
  25.             return salida;
  26.         }
  27.  
  28.         public static boolean comprobadorPreguntas(boolean respuestaALaPrimera){
  29.         if (respuestaALaPrimera==true){
  30.             contador++;
  31.         }
  32.         return respuestaALaPrimera;
  33.     }
  34.  
  35.  
  36.         public int getMultiplicador() {
  37.             return multiplicador;
  38.         }
  39.  
  40.  
  41.         public int getMultiplicando() {
  42.             return multiplicando;
  43.         }
  44.  
  45.  
  46.         public static int getContador(){
  47.             return contador;
  48.         }
  49.  
  50.         public String getNumeroPregunta(){
  51.             return "PREGUNTA Nº: "+numeroPregunta;
  52.         }
  53.  
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement