Está en la página 1de 2

mensaje("Es par"

mensaje("Es par");

public static void main (String[] args) {

return true;

else

return false;

static String mensaje;

return JOptionPane.showInputDialog(mensaje);

Operacion is already defined in Operacion(java.lang.String)

{
Inicio();
}

public static void Inicio()


{
Clase_B y= new Clase_B();
y.mensaje(" Bienvenido a \nNuestro Examen De La Unidad 3");

String dato= y.pide_datos("Introduce un Un Numero [0-9]");


if (y.validame(dato,"[0-9]*")== true)
{
y.mensaje("Numero Aceptado.");
y.mensaje(y.Operación(dato));
}
}
}

import javax.swing.JOptionPane;

public class Clase_B


{
public static void main (String[] args)
{
Clase_A x= new Clase_A();
x.Inicio();
}

public void mensaje(String msj)


{
JOptionPane.showMessageDialog(null, msj);
}

public String pide_datos(String msj)


{
return JOptionPane.showInputDialog(msj);
}

public boolean validame (String Dato, String Valores)


{
if (Dato.length()==
jajaja
{
mensaje("No Es Un Numero");
return false;
}
else
if(Dato.matches(Valores))
return true;
else
{
mensaje("bienvenido a:");
return false;
}
}
public String Operación(String Val)
{
String Txt="";
int a,b= Integer.parseInt(Val);
float c, d= Float.parseFloat(Val);
a= b/2;
c= d/2;
if(a==c)
Txt= "El Número Insertado Es Par \n Bye, Bye";
else
Txt= "El Número Insertado Es Impar \n Bye, Bye";

return Txt;
}
}

while (Numero.matches("[0-9]*")!=true);

También podría gustarte