Terreno - double adicional = 0; if(esEsquina) adicional =...

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

View Full Document Right Arrow Icon
public class Terreno{ p public int frente, fondo; public double precioPorMetro; public boolean esEsquina, frenteAParque; p //Constructores public Terreno(){ frente = 0; fondo = 0; precioPorMetro = 0; esEsquina = false; frenteAParque = false;} f public Terreno(int fr, int fo, double ppm, boolean ee, boolean fap){ frente = fr; fondo = fo; precioPorMetro = ppm; esEsquina = ee; frenteAParque = fap;} f //GETs y SETs public int getFrente(){ return frente;} r public int getFondo(){ return fondo;} r public double getPrecioPorMetro(){ return precioPorMetro;} r public boolean getEsEsquina(){ return esEsquina;} r public boolean getFrenteAParque(){ return frenteAParque;} r public void setFrente(int fr){ frente = fr;} f public void setFondo(int fo){ fondo = fo;} f public void setPrecioPorMetro(double ppm){ precioPorMetro = ppm;} p public void setEsEsquina(boolean ee){ esEsquina = ee;} e public void setFrenteAParque(boolean fap){ frenteAParque = fap;} f //Otros métodos. public double calculaValorVenta(double comision){ double price = frente*fondo*precioPorMetro;
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: double adicional = 0; if(esEsquina) adicional = price*1.03; if(frenteAParque) adicional = price*1.05; if(esEsquina==true && frenteAParque==true) adicional = price*1.08; if(esEsquina==false && frenteAParque==false) adicional = price; double total = adicional + adicional*(comision/100); return total;} r public String toString(){ String t=fondo+"m. x "+frente+"m."; if((esEsquina==true) && (frenteAParque==false)) t=t+" en esquina, Precio: $"; if((esEsquina==false) && (frenteAParque==true)) t=t+" frente a parque. Precio: $"; if((esEsquina==true) && (frenteAParque==true)) t=t+" en esquina y frente a parque. Precio: $"; if((esEsquina==false) && (frenteAParque==false)) t=t+" Precio: $"; return t;} r public boolean equals(Terreno t){ return(frente==t.frente && fondo==t.fondo && precioPorMetro==t.precioPorMetro && esEsquina==t.esEsquina && frenteAParque==t.frenteAParque);} }...
View Full 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

Terreno - double adicional = 0; if(esEsquina) adicional =...

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