Package br.com.turmajava.exercicios

Source Code of br.com.turmajava.exercicios.Exercicio20

package br.com.turmajava.exercicios;

import java.util.Scanner;

public class Exercicio20 {

  public static void main(String[] args) {

    Scanner leitor = new Scanner(System.in);

    while (!leitor.next().equalsIgnoreCase("Nao")) {
      float valor = leitor.nextFloat();
      int ano = leitor.nextInt();
      float desconto = 0;
      float valorPago = 0;

      if (ano <= 2000) {
        desconto = valor * 0.12f;
      } else {
        desconto = valor * 0.07f;
      }

      valorPago = valor - desconto;
      System.out.println("Desconto: " + desconto);
      System.out.println("Valor Pago: " + valorPago);
    }
    leitor.close();
  }

}
TOP

Related Classes of br.com.turmajava.exercicios.Exercicio20

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.