Write a class called MiNumero
in Java. The methods of the class should be:
- Constructor without parameters (will set the number to zero)
- Constructor with integer parameter (will assign that value to the number)
- Method
cambiaNumero(int)
: allows you to assign a new value to the number
The code:
public class MiNumero {
private int Valor;
private int camValor;
public int getCamValor() {
return camValor;
}
public void setCamValor(int camValor) {
this.camValor = camValor;
}
public int getValor() {
return Valor;
}
public void setValor(int Valor) {
this.Valor = Valor;
}
public int cambiaNumero(int camValor) {
return Valor = camValor;
}