Created
December 21, 2011 10:56
-
-
Save rafaelchagasb/1505607 to your computer and use it in GitHub Desktop.
Decorator - Exercício 2
This file contains 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 class ImpostoMuitoAlto extends Imposto{ | |
public ImpostoMuitoAlto(Imposto outroImposto){ | |
super(outroImposto); | |
} | |
public ImpostoMuitoAlto() { | |
} | |
@Override | |
public double calcula(Orcamento orcamento) { | |
return orcamento.getValor()*0.2 + calculoDoOutroImposto(orcamento); | |
} | |
} | |
public class TestaImpostoAlto { | |
public static void main(String[] args) { | |
Orcamento orcamento = new Orcamento(700.0); | |
Imposto impostoComposto = new ImpostoMuitoAlto(new ISS()); | |
System.out.println(impostoComposto.calcula(orcamento)); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment