Advertisement
hercioneto

Classe Pedidos deve estar junto com o projeto Lanchonete

Dec 4th, 2023
1,184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1. /**
  2.  *
  3.  * @author Professor Hercio neto
  4.  */
  5. public class Pedido {
  6.  
  7.     private Integer[] quantidades;
  8.     private Integer totalItens;
  9.     private Float[] valores, valoresT;
  10.     private Float taxaGarcon, totalGeral, total;
  11.  
  12.     public Integer[] getQuantidades() {
  13.         return quantidades;
  14.     }
  15.  
  16.     public void setQuantidades(Integer[] quantidades) {
  17.         this.quantidades = quantidades;
  18.     }
  19.  
  20.     public Float[] getValores() {
  21.         return valores;
  22.     }
  23.  
  24.     public Float[] getValoresT() {
  25.         return valoresT;
  26.     }
  27.  
  28.     public void setValoresT() {
  29.         Float soma = 0f;
  30.         Float[] tot = new Float[]{0f, 0f, 0f, 0f, 0f, 0f};
  31.  
  32.         for (int i = 0; i < this.quantidades.length; i++) {
  33.  
  34.             tot[i] = this.quantidades[i] * this.valores[i];
  35.             soma = soma + tot[i];
  36.  
  37.         }
  38.  
  39.         this.valoresT = tot;
  40.         this.setTotal(soma);
  41.         this.setTaxaGarcon();
  42.     }
  43.  
  44.     public void setValores(Float[] valores) {
  45.         this.valores = valores;
  46.     }
  47.  
  48.     public Integer getTotalItens() {
  49.         return totalItens;
  50.     }
  51.  
  52.     public void setTotalItens(Integer totalItens) {
  53.         this.totalItens = totalItens;
  54.     }
  55.  
  56.     public Float getTotal() {
  57.         return total;
  58.     }
  59.  
  60.     public void setTotal(Float total) {
  61.         this.total = total;
  62.     }
  63.  
  64.     public Float getTaxaGarcon() {
  65.         return taxaGarcon;
  66.     }
  67.  
  68.     public void setTaxaGarcon() {
  69.         Float taxa = this.getTotal() * 0.12f;
  70.         this.taxaGarcon = taxa;
  71.         this.setTotalGeral();
  72.  
  73.     }
  74.  
  75.     public Float getTotalGeral() {
  76.         return totalGeral;
  77.     }
  78.  
  79.     public void setTotalGeral() {
  80.         this.totalGeral = this.getTotal() + this.getTaxaGarcon();
  81.     }
  82.  
  83. }
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement