Java : Source Code Pemesanan Makanan - RM Tutorial

Terbaru

03 October 2017

Java : Source Code Pemesanan Makanan


Java - Ini adalah source code pemesanan makanan berbasis Java yang saya buat, semoga bermanfaat.

import java.util.Scanner;

class NIM16020031{
 public static void main(String[]args){
  Scanner input =new Scanner(System.in);
  int a = 0;      
        double bayar1 = 0;  double bayar2=0;double bayar3=0;double bayar4=0;double bayar5=0;
  double total=0;

  System.out.println("SELAMAT DATANG DI KIPI KOPI");
        System.out.println(" ##############################################");      
        System.out.println("|    Menu          |");     
  System.out.println(" ##############################################");   
  
  for(String b = "y"; b.equals("y") || b.equals("Y");){  
  
  System.out.println("1. Makanan");
  System.out.println("2. Minuman");
  System.out.println("3. Keluar");
  System.out.println("-----------------------------------------------");
  
  
  System.out.print("Silahkan Pilih   : ");
  a = input.nextInt();
  
  
  if(a == 1){
   double indo=8000;
   double migor=9000;
   double migorkang=12000;
   System.out.println(" ##############################################");      
            System.out.println("   Daftar Makanan");
   System.out.println(" ##############################################");      
   System.out.println("1. Mie Indomie Kuah  : Rp. 8.000");
   System.out.println("2. Mie Goreng Aceh  : Rp. 9.000");
   System.out.println("3. Mie Goreng Kangkung  : Rp. 12.000");
            System.out.println(" ______________________________________________");      
   System.out.println();
   System.out.println("Masukkan Jumlah yang anda beli  : ");
   
   System.out.print("1. Mie Indomie Kuah  : ");
   int mak = input.nextInt();
   System.out.print("2. Mie Goreng Aceh  : ");
   int mak1 = input.nextInt();
   System.out.print("3. Mie Goreng Kangkung  : ");
   int mak2 = input.nextInt();
   System.out.println();
   
   bayar1=mak*8000;
    bayar2=mak1*9000;
    bayar3=mak2*12000;
   
   
   
   
        }else if(a==2){
            double teh=6000;
   double kopi=5000;
   System.out.println(" ##############################################");      
            System.out.println("  Daftar Minuman");
   System.out.println(" ##############################################");      
   System.out.println("1. Teh Hangat/Dingin  : Rp. 6.000");
   System.out.println("2. Kopi Gayo   : Rp. 5.000");
   System.out.println("_______________________________________________");      
            
   System.out.println();
   System.out.println("Masukkan Jumlah yang anda beli  : ");
   
   System.out.print("1. Teh Hangat/Dingi  : ");
   int min = input.nextInt();
   System.out.print("2. Kopi Gayo   : ");
   int min1 = input.nextInt();
   
   System.out.println();
   
    bayar4=min*6000;
    bayar5=min1*5000;
   
        
        }else{
            System.out.println(" Terimakasih");
        
  
  }
  System.out.print("Apakah Anda Mau Memilih Menu Lain? (Y/T) "); 
        b = input.next();

        }
  
  total=bayar1+bayar2+bayar3+bayar4+bayar5;
  if (total>=50000 && total<=100){
   System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
   System.out.println("Total belanja anda adalah Rp. "+total);
   double diskon1=total*0.05;
   double total1=total-diskon1;
   System.out.println();
   System.out.println("Selamat Anda mendapatkan diskon 5%");
   System.out.println();
   System.out.println("Total yang harus anda bayarkan adalah Rp. "+total1);
   System.out.println("*********** TERIMA KASIH ***************");
  }else if(total>100){
   System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
   System.out.println("Total belanja anda adalah Rp. "+total);
   System.out.println();
   System.out.println("Selamat anda mendapat diskon sebesar 10%");
   double diskon2=total*0.1;
   double total2=total-diskon2;
   System.out.println();
   System.out.println("Total yang harus anda bayarkan adalah Rp. "+total2);
   System.out.println("*********** TERIMA KASIH ***************");
  }else{
   System.out.println("Total yang harus anda bayarkan adalah Rp. "+total);
   
  }
        
 }
}