Skip to content

Instantly share code, notes, and snippets.

@AlfredoCasado
Created January 10, 2011 18:47
Show Gist options
  • Save AlfredoCasado/773229 to your computer and use it in GitHub Desktop.
Save AlfredoCasado/773229 to your computer and use it in GitHub Desktop.
Iteracion 3 modelo
public interface Descuento {
int aplicar(int precioAntesDeAplciarDescuento);
}
public class DescuentoConPorcentaje implements Descuento {
private int porcentajeDeDescuento;
public int aplicar(int precioAntesDeAplicarDescuento) {
return (porcentajeDeDescuento/100)*precioAntesDeAplicarDescuento;
}
}
public class DescuentoConCantidadFija implements Descuento {
private int cantidadFijaDeDescuento;
public int aplicar(int precioAntesDeAplciarDescuento) {
return precioAntesDeAplciarDescuento - cantidadFijaDeDescuento;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment