November 2021

My Blog

Latest blog

 Penerapan Array 1 Dimensi pada program kasir sederhana

Yanuar Hakam Rosyadi Ahmad (21082010079)



Berikut adalah source code dari program kasir "Kams Korean Street Food"

 

public static void main(String[] args) {
        Scanner s = new Scanner (System.in);
        String makanan [];
        makanan = new String [5];
        int harga [] = new int [5];
        int porsi []= new int [5];
        int subtotal [] = new int [5];
        int total=0,   indeks=0,  pilih=0,  uang, kembali;
        System.out.println("\tKams\t"+"\n Korean Street Foods");
        do{
            System.out.println("\nDaftar Menu :  "
           + "\n1. Odeng\tRp. 15.000" 
            + "\n2. Tteokbokki\tRp. 10.000"
            + "\n3. Gimbab      \tRp. 12.000"
            + "\n4. Twigim      \tRp. 8.000"
            + "\n5. Dakkoci   \tRp. 10.000"
            + "\n6. Selesai");
            System.out.print ("Pilih        : ");
            pilih=s.nextInt();
            switch (pilih){
                case 1:
                    makanan[indeks]="Odeng";
                    harga[indeks]=15000;
                    System.out.print("Jumlah porsi : ");
                    porsi [indeks] = s.nextInt();
                    subtotal[indeks]=porsi[indeks]*harga[indeks];
                       System.out.println("-----------------------------------");
                    break;
                case 2:
                    makanan[indeks]="Tteokbokki";
                    harga[indeks]=10000;
                    System.out.print("Jumlah porsi : ");
                    porsi [indeks] = s.nextInt();
                     subtotal[indeks]=porsi[indeks]*harga[indeks];
                        System.out.println("-----------------------------------");
                    break;
                case 3:
                    makanan[indeks]="Gimbab";
                    harga[indeks]=12000;
                    System.out.print("Jumlah porsi : ");
                    porsi [indeks] = s.nextInt();
                     subtotal[indeks]=porsi[indeks]*harga[indeks];
                     System.out.println("-----------------------------------");
                    break;
                case 4:
                   makanan[indeks]="Twigim";
                    harga[indeks]=8000;
                    System.out.print("Jumlah porsi : ");
                    porsi [indeks] = s.nextInt();
                    subtotal[indeks]=porsi[indeks]*harga[indeks];
                       System.out.println("-----------------------------------");
                    break;
                case 5:
                    makanan[indeks]="Dakkoci";
                    harga[indeks]=10000;
                    System.out.print("Jumlah porsi : ");
                    porsi [indeks] = s.nextInt();
                    subtotal[indeks]=porsi[indeks]*harga[indeks];
                       System.out.println("-----------------------------------");
                    break;
            } indeks++;
        } while (pilih!=6);
        //menampilkann daftar yang dibeli
          System.out.println("==========================");
        System.out.println("\nDAFTAR STRUK");
        for (int i = 0; i < indeks-1; i++) {
        System.out.println((i+1) + ".  "+ makanan[i]);
            System.out.println("    Jumlah\t: " +porsi[i]);
            System.out.println("    Sub Total\t: "+subtotal[i]);
            total=total+subtotal[i];
        }   System.out.println("\n---------------------------------------");
          System.out.println("TOTAL     \t: "+total);
          System.out.print("TUNAI     \t: ");
          uang=s.nextInt();
          kembali=uang-total;
          System.out.println("Kembalian \t: "+kembali);
          System.out.println("kam-sa-ham-ni-da"+"\nTerimakasih :)");
          System.out.println("==========================");  
    }

 Program Menampilkan Deret Bilangan Prima

Yanuar Hakam Rosyadi Ahmad
21082010079
Paralel B


 














.







Source code :
 public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        int index = 0;
        int jumlah = 0;
    
        int masukan;
        System.out.print("Masukkan jumlah deret = ");
        masukan = sc.nextInt();
        
        System.out.print("Deret bilangan prima = ");
        for (int i = 2;index

Contact Me

Contact With Me

Break

Random Posts

randomposts

Recent Posts

recentposts
banner image

Lorem Ipsum is simply dummy text of the printing and type setting industry when an unknown printer took a galley of type

  • 9908B Wakehurst St.Rockaway
  • 990800113322
  • info@domain.com
  • www.yourinfo.com