danimaaan

Regra de desconto

Apr 16th, 2021
674
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package br.com.alura.desconto;
  2.  
  3. import java.math.BigDecimal;
  4.  
  5. import br.com.alura.orcamento.Orcamento;
  6.  
  7. public class DescontoParaOrcamentoComMaisDeCincoItens extends Desconto {
  8.  
  9.     public DescontoParaOrcamentoComMaisDeCincoItens(Desconto proximo) {
  10.         super(proximo);
  11.     }
  12.  
  13.     public BigDecimal calcular(Orcamento orcamento) {
  14.         if (orcamento.getQuantidadeItens() > 5) {
  15.             return orcamento.getValor().multiply(new BigDecimal("0.1"));
  16.         }
  17.         return this.proximo.calcular(orcamento);
  18.     }
  19. }
  20.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×