Numero - public class Numerocfw_ p public int valor;...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Numero{ p public int valor; p //Constructores public Numero(){ valor=0;} v public Numero(int v){ valor = v;} v //GETs y SETs / public int getValor(){ return valor;} r public void setValor(int v){ valor = v;} v //Otros métodos / public Numero elMayor(Numero n){ if(this.getValor()>n.getValor()) return this; else return n;} r public Numero elMenor(Numero n){ if(this.getValor()<n.getValor()) return this; else return n;} r public boolean igual(Numero n){ if(this.valor == n.valor) return true; else return false;} r public boolean esPar(){ if(valor%2 == 0) return true; else return false;} r public String toString(){ String temp = "Este es el número: "; switch(valor){ case 0: temp = temp + "cero."; break; case 1: temp = temp + "uno."; break; case 2: temp = temp + "dos."; break; case 3: temp = temp + "tres."; break; case 4: temp = temp + "cuatro."; break; case 5: temp = temp + "cinco."; break; case 6: temp = temp + "seis."; break; case 7: temp = temp + "siete."; break; case 8: temp = temp + "ocho."; break; case 9: temp = temp + "nueve."; break;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
default: return "No me sé éste número =(.";} return temp;}
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/29/2009 for the course ITC TC-1002 taught by Professor X during the Spring '09 term at ITESM.

Page1 / 2

Numero - public class Numerocfw_ p public int valor;...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online