Senin, 21 Desember 2015

Coding Percabangan

/*
 * 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 perbaikan_uts;
import java.util.Scanner;
/**
 *
 * @author axioo
 */
public class Perbaikan_Uts {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner dit = new Scanner (System.in);
       int a=1 ;
       int b=1 ;
        System.out.println("Selamat datang di toko \n1. Masukkan jumlah rokok yang anda beli :");
        int jumlah=dit.nextInt();
        for (int i = 1; i <= jumlah; i++) {
            System.out.println("Barang ke : " +i+ "Dengan harga : " );
            int iku = dit.nextInt();
        if (iku<=20000){
            System.out.println("| AWAKMU NGELEK ROKOK SENG MURAHAN |\n Masukkan jenis rokok yang anda beli : ");
            int rokok = dit.nextInt();
         do {
             System.out.println("Rokok ke : " +a+ " \n1.Rokok filter  ");
             iku++;
             iku=dit.nextInt();
             switch (iku){
                 case 1 :
                     System.out.println("Anda telah memilih rokok filter  \nBerapa banyak rokok yang anda hisap :");
                     int anu=dit.nextInt();
                     while (b<=anu){
                         System.out.println("Rokok filter ke : " +b+ " DI SEDOT");
                         b++;
                     }
                 
                     }
             break;
         }while (a<=iku);
       
       
        }
         else if (iku>=2000){
             System.out.println("|GK ONOK ROKOK REGONE SAK MENE IKI !!!!!!!!!!|");
             }
         }  
        }  
           
        }
   
   

Tidak ada komentar:

Posting Komentar