Source Code :
public class Menu{
public static void main(String[]args){
int i;
for(i=1; i<=1000; i++){
System.out.print("\n\nMENU:");
System.out.print("\n1. Red");
System.out.print("\n2. Blue");
System.out.print("\n3. Yellow");
System.out.print("\n4. Green");
System.out.print("\n5. Exit");
System.out.print("\nMasukan pilihan:");
String aStr = System.console().readLine();
int menu = Integer.parseInt(aStr);
switch(menu){
case 1:
System.out.print("Anda memilih Merah");break;
case 2:
System.out.print("Anda memilih Biru");break;
case 3:
System.out.print("Anda memilih Kuning");break;
case 4:
System.out.print("Anda memilih Hijau");break;
case 5:
System.out.print("Anda Memilih Keluar,Bye");
System.exit(0);break;
default:
System.out.print("Salah pilih mas Gan Coba lagi Deh");
}
}
}
}
Outputnya :
Monday, April 1, 2013
Membuat Program Menu
Silahkan Copas Gannnn,,,,
Tapi Tolong Jangan Lupa Komentarnya yy gann,,,
0 comments:
:)) :)] ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} ~x( :-t b-( :-L x( =))
Post a Comment