Skip to content

Instantly share code, notes, and snippets.

@alexduarte
Created December 20, 2011 21:15
Show Gist options
  • Save alexduarte/1503308 to your computer and use it in GitHub Desktop.
Save alexduarte/1503308 to your computer and use it in GitHub Desktop.
public class ImpostoMuitoAlto extends Imposto {
public ImpostoMuitoAlto(Imposto outroImposto) {
super(outroImposto);
}
public ImpostoMuitoAlto() {
}
public double calcula(Orcamento orcamento) {
return orcamento.getValor()*0.2 + calculoDoOutroImposto(orcamento);
}
}
public class TestaImpostoComplexo {
public static void main(String[] args) {
Imposto higherIp = new ImpostoMuitoAlto(new ISS(new ICMS()));
Orcamento orcamento = new Orcamento(500);
double valor = higherIp.calcula(orcamento);
System.out.println(valor);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment