Ver Mensaje Individual
  #7 (permalink)  
Antiguo 11/06/2009, 14:16
jefergalvis
 
Fecha de Ingreso: junio-2009
Mensajes: 13
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: Numero positivo o negativo

Hola a todos por fin pude desarrollar el ejercicio era de lo mas sencillo que yo creia....

Es el siguiente para realizar la operacion:
public boolean positivo(int n){
if(n>0) return true;
else return negativo(n);
}
public boolean negativo(int n){
if(n<0) return false;
else return positivo(n);
}

y en el boton es la siguiente

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
boolean numero;
operacion p = new operacion();

numero = p.positivo(Integer.parseInt(num.getText()));

if(numero){
salida.setText("Positivo");
}
else{
salida.setText("Negativo");
}