programación i - Universidad ORT Uruguay
programación i - Universidad ORT Uruguay
programación i - Universidad ORT Uruguay
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Programación I 107<br />
12.1.3 Clase Gasto<br />
package gastosCasa;<br />
import java.util.*;<br />
public class Gasto {<br />
// variables de instancia<br />
private int monto;<br />
private int dia;<br />
private String descripcion;<br />
// Constructores<br />
public Gasto() {<br />
this.setDia(1);<br />
this.setDescripcion("Sin datos");<br />
this.setMonto(0);<br />
}<br />
public Gasto(int unDia, String unaD, int unM) {<br />
this.setDia(unDia);<br />
this.setDescripcion(unaD);<br />
this.setMonto(unM);<br />
}<br />
// acceso y modificacion<br />
public void setDescripcion(String unaDescripcion) {<br />
descripcion = unaDescripcion;<br />
}<br />
public String getDescripcion() {<br />
return descripcion;<br />
}<br />
public int getDia() {<br />
return dia;<br />
}<br />
public void setDia(int unDia) {<br />
dia = unDia;<br />
}<br />
public int getMonto() {<br />
return monto;<br />
}<br />
public void setMonto(int unMonto) {<br />
monto = unMonto;<br />
}<br />
// Impresion<br />
@Override<br />
public String toString() {<br />
return "Gasto " + this.getDescripcion() + " $ " + this.getMonto() + " Dia: " +<br />
this.getDia();<br />
}