Skip to content

Instantly share code, notes, and snippets.

@praser
Created December 27, 2018 20:04
Show Gist options
  • Save praser/5d7ab3748e4ecdc22d82f19d6739c84e to your computer and use it in GitHub Desktop.
Save praser/5d7ab3748e4ecdc22d82f19d6739c84e to your computer and use it in GitHub Desktop.
Exemplo TDD - Truncado as casas decimais do valor da comissão
public class Comissao {
private final double BASE_CALCULO_COMISSAO = 10000;
public double calcularComissao(double valorVenda) {
double aliquotaComissao;
aliquotaComissao = valorVenda <= BASE_CALCULO_COMISSAO ? 0.05 : 0.08;
return Math.floor(valorVenda * aliquotaComissao * 100) / 100;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment