Skip to content

Instantly share code, notes, and snippets.

@alexduarte
Created December 20, 2011 05:17
Show Gist options
  • Save alexduarte/1500365 to your computer and use it in GitHub Desktop.
Save alexduarte/1500365 to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
public class IHIT extends TemplateDeImpostoCondicional {
;
public boolean deveUsarMaximaTaxacao(Orcamento orcamento) {
return existe(orcamento);
}
public double maximaTaxacao(Orcamento orcamento) {
return orcamento.getValor()*0.13 + 100;
}
public double minimaTaxacao(Orcamento orcamento) {
return orcamento.getValor()*0.01 * orcamento.getItens().size() ;
}
public boolean existe(Orcamento orcamento){
ArrayList<Item> itens = new ArrayList<Item>();
for(Item item: orcamento.getItens()){
for(int i = 0; i< itens.size(); i++){
if(item.getNome().equals(itens.get(i).getNome())){
itens.add(item);
return true;
}
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment