uts algoritma

/*
* 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 menu.makanan;

/**
*
* @author wahyu
*/import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class MenuMakanan {

/**
* @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";

System.out.println("Menu Makanan ");
System.out.println("++++++++++++++++++++++++++++ ");
System.out.println("1. Ayam Goreng =Rp 15000 ");
System.out.println("2. Nasi Goreng =Rp 10000 ");
System.out.println("3. Mie Goreng =Rp 5000 ");

while (keputusan.equals("Y")||keputusan.equals("y"))
{
System.out.print("Pilihan menu anda = ");
int pil = input.nextInt();
switch (pil) {
case 1:
menu [i] = "Ayam Goreng";
harga [i] = 15000;
break;
case 2:
menu [i] = "Nasi Goreng";
harga [i] = 10000;
break;
case 3:
menu [i] = "Mie Goreng";
harga [i] = 5000;
break;
default:
System.out.println("Maaf pilihan menu anda tidak tepat ");
menu[i] = "tidak ada";
break;
}
System.out.println("Menu yang anda pesan adalah : "+menu[i]);
System.out.println("Harga yang harus dibayar : "+harga[i]);
System.out.println("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];
}
System.out.println("Total yang harus anda bayar adalah : Rp."+hargatotal);
}
}
}