Senin, 28 September 2015

Diskon

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication7;
import java.util.Scanner;
/**
 *
 * @author DELL
 */
public class JavaApplication7 {

    public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
     
       int harga,total,diskon,jumlah;
       System.out.println("Masukkan nama item");
       String item=sc.next ();
       System.out.println("Masukkan harga");
       harga=sc.nextInt();
       System.out.println("Masukkan jumlah");
       jumlah=sc.nextInt();
       total=harga*jumlah;
       System.out.println("Total biaya anda adalah "+total);  
       
       if (jumlah<3)
       {
          total = total -((total*15)/100);
          System.out.println("Diskon 15%");
      }
      if (jumlah >= 3){
          total = total - ((total*25)/100);
          System.out.println("Karena jumlah barang lebih dari 3 maka diskon anda berubah menjadi 25%\nTotal Bayar = Rp."+total);
      }
      else{
          System.out.println("Total Bayar anda = Rp."+total);
     }
    }
}






Tidak ada komentar:

Posting Komentar