Advertisement
gilang05

Untitled

Sep 20th, 2020
949
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.19 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package setget;
  7. import java.util.Scanner;
  8. /**
  9.  *
  10.  * @author G PERMATA
  11.  */
  12. public class warung {
  13.    public int kode;
  14.    
  15.    public void setPilih(int kode_menu){
  16.        kode=kode_menu;
  17.    }
  18.    
  19.    public String getMenu(){
  20.        String jajan;
  21.         switch (kode) {
  22.             case 1:
  23.               jajan="seblak";
  24.               break;
  25.            
  26.             case 2:
  27.               jajan="bakaran";
  28.               break;    
  29.            
  30.             case 3:
  31.                 jajan="roti";
  32.                 break;
  33.            
  34.             default:
  35.                 jajan="ra nde det";
  36.                  break;
  37.         }
  38.         return jajan;
  39.    }
  40.    public static void main(String[] args) {
  41.         Scanner input = new Scanner(System.in);
  42.         int a;
  43.         System.out.print("masukkan nomor menu : ");
  44.         a = input.nextInt();
  45.         warung orderan=new warung();
  46.         orderan.setPilih(a);
  47.         System.out.println("makanan yg anda pilih "+orderan.getMenu());
  48.    }
  49.  
  50.    
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement