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 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; | |
} |
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 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 valorVenda * aliquotaComissao; | |
} |
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
import static org.junit.jupiter.api.Assertions.assertEquals; | |
import org.junit.jupiter.api.Test; | |
public class ComissaoTeste { | |
@Test | |
public void testeUmaVenda10000_00PagaComissaoDe500_00() { | |
//Arrange | |
Comissao comissao = new Comissao(); |
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
import static org.junit.jupiter.api.Assertions.assertEquals; | |
import org.junit.jupiter.api.Test; | |
public class ComissaoTeste { | |
@Test | |
public void testeUmaVenda10000_00PagaComissaoDe500_00() { | |
//Arrange | |
Comissao comissao = new Comissao(); |
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 Comissao { | |
private final double BASE_CALCULO_COMISSAO = 10000; | |
public double calcularComissao(double valorVenda) { | |
return valorVenda <= BASE_CALCULO_COMISSAO ? 500 : 800.08; | |
} | |
} |
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 Comissao { | |
public double calcularComissao(double valorVenda) { | |
double comissao; | |
if (valorVenda <= 10000) { | |
comissao = 500; | |
} else { | |
comissao = 800.08; | |
}; | |
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
import static org.junit.jupiter.api.Assertions.assertEquals; | |
import org.junit.jupiter.api.Test; | |
public class ComissaoTeste { | |
@Test | |
public void testeUmaVendaDeDezMilPagaComissaoDeQuinhentos() { | |
//Arrange | |
Comissao comissao = new Comissao(); |
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 Comissao { | |
public double calcularComissao(double valorVenda) { | |
return 500; | |
} | |
} |
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 Comissao { | |
public double calcularComissao(double valorVenda) { | |
return 0; | |
} | |
} |
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 Comissao { | |
} |
NewerOlder