Pembayaran/Kasir (TUGAS UAS)
*
* 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.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
*
* @author rizky
*/
public class Menu {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner (System.in);
BufferedReader input2 = new BufferedReader (new InputStreamReader (System.in));
int i = 0;
int hargatotal = 0;
int penampung = 0;
String menu[] = new String [100];
int harga[] = new int [100];
String keputusan="Y";
String disc;
int diskon;
System.out.println("----------------------MENU-----------------------");
System.out.println("-------------------------------------------------");
System.out.println("1. MIE AYAM KOMPLIT = Rp 17.000");
System.out.println("2. NASI GORENG SEAFOOD/SOSIS/SPECIAL= Rp 20.000");
System.out.println("3. NASI UDUK = Rp 15.000");
System.out.println("4. NASI BAKAR = Rp.13.000");
System.out.println("5. INDOMIE SPECIAL REBUS/GORENG = Rp.17.000");
System.out.println("6. TEH ES/HANGAT = Rp. 5.000");
System.out.println("7. ANEKA JUS BUAH = Rp.10.000");
System.out.println("8. KOPI HITAM = Rp. 7.000");
System.out.println("-------------------------------------------------");
while (keputusan.equals("Y")||keputusan.equals("y"))
{
System.out.print("SILAHKAN KLIK NOMER YANG ANDA PESAN = ");
int pil = input.nextInt();
if (pil==1){
menu[i] = "MIE AYAM KOMPLIT";
harga[i] = 15000;
} else if (pil==2) {
menu[i]= "NASI GORENG SEAFOOD/SOSIS/SPECIAL";
harga[i] = 17000;
} else if (pil==3) {
menu[i]="NASI UDUK";
harga[i] = 15000;
} else if (pil==4) {
menu[i]= "NASI BAKAR";
harga[i] = 17000;
} else if (pil==5) {
menu[i]= "INDOMIE SPECIAL REBUS/GORENG";
harga[i] = 16000;
} else if (pil==6) {
menu[i]= "TEH ES/HANGAT";
harga[i] = 5000;
} else if (pil==7) {
menu[i]= "ANEKA JUS BUAH";
harga[i] = 8000;
} else if (pil==8) {
menu[i]= "KOPI HITAM";
harga[i] = 10000;
} else {
System.out.println("Maaf pilihan menu anda tidak tepat ");
menu[i]= "Tidak Ada";
}
System.out.println("Menu yang anda pesan adalah : "+menu[i]);
System.out.println("Harga yang harus dibayar : "+harga[i]);
System.out.print("Apakah anda ingin memesan lagi ? Y/T : ");
try{
keputusan = input2.readLine();
}catch(IOException e){
System.out.println("Gagal Membaca Keyboard");
}
i++;
}
System.out.println("");
System.out.println("Menu yang anda pesan adalah : "+i);
for (int a = 0; a<i;a++){
System.out.print(menu[a]+", ");
}
System.out.println("");
for (int b = 0; b<i;b++){
hargatotal = hargatotal + harga[b];
}
if (hargatotal>=30000){
diskon=hargatotal-5000;
disc = "Mendapat potongan harga 5000";
}else{
disc = "Jika total pembelian lebih dari Rp. 10.000 mendapat potongan sebesar Rp. 5.000";
diskon=hargatotal;
}
System.out.println("Total yang harus anda bayar adalah : Rp."+diskon);
System.out.println(disc);
System.out.println("");
System.out.println("-----------TERIMA KASIH DATANG KEMBALI------------");
}
}
* 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.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
*
* @author rizky
*/
public class Menu {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner (System.in);
BufferedReader input2 = new BufferedReader (new InputStreamReader (System.in));
int i = 0;
int hargatotal = 0;
int penampung = 0;
String menu[] = new String [100];
int harga[] = new int [100];
String keputusan="Y";
String disc;
int diskon;
System.out.println("----------------------MENU-----------------------");
System.out.println("-------------------------------------------------");
System.out.println("1. MIE AYAM KOMPLIT = Rp 17.000");
System.out.println("2. NASI GORENG SEAFOOD/SOSIS/SPECIAL= Rp 20.000");
System.out.println("3. NASI UDUK = Rp 15.000");
System.out.println("4. NASI BAKAR = Rp.13.000");
System.out.println("5. INDOMIE SPECIAL REBUS/GORENG = Rp.17.000");
System.out.println("6. TEH ES/HANGAT = Rp. 5.000");
System.out.println("7. ANEKA JUS BUAH = Rp.10.000");
System.out.println("8. KOPI HITAM = Rp. 7.000");
System.out.println("-------------------------------------------------");
while (keputusan.equals("Y")||keputusan.equals("y"))
{
System.out.print("SILAHKAN KLIK NOMER YANG ANDA PESAN = ");
int pil = input.nextInt();
if (pil==1){
menu[i] = "MIE AYAM KOMPLIT";
harga[i] = 15000;
} else if (pil==2) {
menu[i]= "NASI GORENG SEAFOOD/SOSIS/SPECIAL";
harga[i] = 17000;
} else if (pil==3) {
menu[i]="NASI UDUK";
harga[i] = 15000;
} else if (pil==4) {
menu[i]= "NASI BAKAR";
harga[i] = 17000;
} else if (pil==5) {
menu[i]= "INDOMIE SPECIAL REBUS/GORENG";
harga[i] = 16000;
} else if (pil==6) {
menu[i]= "TEH ES/HANGAT";
harga[i] = 5000;
} else if (pil==7) {
menu[i]= "ANEKA JUS BUAH";
harga[i] = 8000;
} else if (pil==8) {
menu[i]= "KOPI HITAM";
harga[i] = 10000;
} else {
System.out.println("Maaf pilihan menu anda tidak tepat ");
menu[i]= "Tidak Ada";
}
System.out.println("Menu yang anda pesan adalah : "+menu[i]);
System.out.println("Harga yang harus dibayar : "+harga[i]);
System.out.print("Apakah anda ingin memesan lagi ? Y/T : ");
try{
keputusan = input2.readLine();
}catch(IOException e){
System.out.println("Gagal Membaca Keyboard");
}
i++;
}
System.out.println("");
System.out.println("Menu yang anda pesan adalah : "+i);
for (int a = 0; a<i;a++){
System.out.print(menu[a]+", ");
}
System.out.println("");
for (int b = 0; b<i;b++){
hargatotal = hargatotal + harga[b];
}
if (hargatotal>=30000){
diskon=hargatotal-5000;
disc = "Mendapat potongan harga 5000";
}else{
disc = "Jika total pembelian lebih dari Rp. 10.000 mendapat potongan sebesar Rp. 5.000";
diskon=hargatotal;
}
System.out.println("Total yang harus anda bayar adalah : Rp."+diskon);
System.out.println(disc);
System.out.println("");
System.out.println("-----------TERIMA KASIH DATANG KEMBALI------------");
}
}
Komentar
Posting Komentar