Created
January 10, 2011 18:47
-
-
Save AlfredoCasado/773229 to your computer and use it in GitHub Desktop.
Iteracion 3 modelo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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