Program Java :Koding Program NetBeans Tugas Pertemuan 6

Dosen Pengampu : Fince Tinus Waruwu,M.Kom
fincetinus.blogspot.com


Koding Program Netbeans


TUGAS PAKAI IF BERSARANG :


package tugasermi3.pakai.pkgif.bersarang;
import java.util.Scanner;
public class TugasErmi3PakaiIFBersarang {

    public static void main(String[] args) {
       Scanner kc=new Scanner (System.in);
        System.out.print("Kode Customer = ");
        int q =kc.nextInt();              
        if (q==15110344) {
            System.out.println("Nama = Ermi Suryani Nasution");
            System.out.println("Alamat = Tanjung Morawa, Gg.Madirsan");
            System.out.println("No HP = 085362399149");
        } else if (q == 15110317){
            System.out.println("Nama = Ridho Ikhsan");
            System.out.println("Alamat = Jalan Batang Kuis, Gg.Damai");
            System.out.println("No HP = 085261582846");
        } else if (q == 15110397){
            System.out.println("Nama = Ulan Gotik");
            System.out.println("Alamat = Amplas, Jalan Lukah");
            System.out.println("No HP = 085762589192");
        }
        else {
            System.out.println("Maaf Kode Salah");
        }
      
               Scanner kode=new Scanner (System.in);
       System.out.print("Kode Barang = ");
       String k=kode.nextLine();
      
       Scanner merek=new Scanner (System.in);
       System.out.print("Merek = ");
       String m=merek.nextLine();
      
       Scanner type=new Scanner (System.in);
       System.out.print("Type = ");
       String t=type.nextLine();
      
       Scanner ram=new Scanner (System.in);
       System.out.print("RAM = ");
       String r=ram.nextLine();
      
       Scanner internal=new Scanner (System.in);
       System.out.print("Internal = ");
       String i=internal.nextLine();
      
       if (k.equals("S-01")){
            if (m.equals("Samsung Galaxy")){
                if(t.equals("S9")){
                    if (r.equals("4GB")){
                        if(i.equals("64GB")){
                        int hrg;
                         hrg = 10000000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
       }    else if (m.equals("Samsung Galaxy")){
                if(t.equals("S9+")){
                    if (r.equals("6GB")){
                        if(i.equals("256GB")){
                        int hrg;
                        hrg = 14000000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
       else if (k.equals("I-P1")){
            if (m.equals("Apple")){
                if(t.equals("Iphone 8")){
                    if (r.equals("2GB")){
                        if(i.equals("64GB")){
                        int hrg;
                        hrg = 91000000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
       }    else if (m.equals("Apple")){
                if(t.equals("Iphone 8+")){
                    if (r.equals("3GB")){
                        if(i.equals("64GB")){
                        int hrg;
                        hrg = 12500000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
      else if (k.equals("SZ-EX")){
            if (m.equals("Sony Experia")){
                if(t.equals("Z")){
                    if (r.equals("3GB")){
                        if(i.equals("11.8GB")){
                        int hrg ;
                        hrg = 70000000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
       }    else if (m.equals("Sony Experia")){
                if(t.equals("Z Ultra")){
                    if (r.equals("2GB")){
                        if(i.equals("11GB")){
                        int hrg;
                        hrg = 32500000;
                        System.out.println("Harga = " +hrg);
                         }
                    }
                }
            }
      
      Scanner jm=new Scanner (System.in);
      System.out.print("Jumlah Pembelian = ");
      int j=jm.nextInt();
    
      if(t.equals("S9")){
                        int th;
                        int hrg;
                        hrg = 10000000;
                        th = j*hrg;
                      
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
      else if(t.equals("S9+")){
                        int th;
                        int hrg;
                        hrg = 14000000;
                        th = j*hrg;
                        System.out.println("Harga = " +th);
                      
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
      else if(t.equals("Iphone 8")){
                        int th;
                        int hrg;
                        hrg = 91000000;
                        th = j*hrg;
                        System.out.println("Harga = " +th);
                      
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
      else if(t.equals("Iphone 8+")){
                        int th;
                        int hrg;
                        hrg = 21500000;
                        th = j*hrg;
                        System.out.println("Harga = " +th);
                      
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
      else if(t.equals("Z")){
                        int th;
                        int hrg;
                        hrg = 70000000;
                        th = j*hrg;
                        System.out.println("Harga = " +th);
                      
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
      else if(t.equals("Z Ultra")){
                        int th;
                        int hrg;
                        hrg = 32500000;
                        th = j*hrg;
                        System.out.println("Harga = " +th);
    
                        if (j==2){
                            double d;
                            d=0.01*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==3){
                            double d;
                            d=0.02*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println ("Discount = "+d);
                            System.out.println ("Total Bayar = "+tb);
                        }
                       else if (j==4){
                            double d;
                            d=0.03*th;
                            double tb;
                            tb = th-d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                       else if (j==5){
                            double d;
                            d=0.04*th;
                            double tb;
                            tb = th - d;
                            System.out.println("Total Harga = "+th);
                            System.out.println("Discount = "+d);
                            System.out.println("Total Bayar = "+tb);
                        }
                         }
    }
    
}



TUGAS PAKAI CASE BERSARANG :

package tugasermi3.pakai.pkgcase.bersarang;
import java.util.Scanner;
public class TugasErmi3PakaiCaseBersarang {

    public static void main(String[] args) {
        Scanner koco=new Scanner (System.in);
        System.out.print("Kode Costumer=");
        int kc=koco.nextInt();
      
        switch (kc) {
            case 15110344 :
            System.out.println("Nama = Ermi Suryani Nasution");
            System.out.println("Alamat = Tanjung Morawa, Gg.Madirsan");
            System.out.println("No HP = 085362399149");
            break;
            case 15110317:
            System.out.println("Nama = Ridho Ikhsan");
            System.out.println("Alamat = Jalan Batang Kuis, Gg.Damai");
            System.out.println("No HP = 085261582846");
            break;
            case 15110397:
            System.out.println("Nama = Ulan Gotik");
            System.out.println("Alamat = Amplas, Jalan Lukah");
            System.out.println("No HP = 085762589192");
            default:
                System.out.println ("Maaf Kode Salah");
            break;
        }
      
        Scanner kode=new Scanner (System.in);
        System.out.print ("Kode Barang = ");
        String k=kode.nextLine();
      
        Scanner merek=new Scanner (System.in);
        System.out.print ("Merek = ");
        String m=merek.nextLine();
      
        Scanner type=new Scanner (System.in);
        System.out.print ("Type = ");
        String t=type.nextLine();
      
        Scanner ram=new Scanner (System.in);
        System.out.print ("Ram = ");
        String r=ram.nextLine();
      
        Scanner internal=new Scanner (System.in);
        System.out.print ("Internal = ");
        String i=internal.nextLine();
      
        switch (k){
            case "S-01":
                switch (m){
                    case "Samsung Galaxy":
                        switch (t){
                            case "S9":
                                switch (r){
                                    case "4GB":
                                        switch (i){
                                            case "64GB":
                                                int hrg;
                                                hrg = 1000000;
                                                System.out.println("Harga = "+hrg);
                                        }
                                }
                        }
                }
                switch (m){
                    case "Samsung Galaxy":
                        switch (t){
                            case "S9+":
                                switch (r){
                                    case "6GB":
                                        switch (i){
                                            case "256GB":
                                                int hrg;
                                                hrg = 1400000;
                                                System.out.println("Harga = "+hrg);
                                                break;
                                        }
                                }
                        }
                }
        }
        switch(k){
            case "I-P1":
                switch (m){
                    case "Apple":
                        switch (t){
                            case "Iphone 8":
                                switch (r){
                                    case "2GB":
                                        switch (i){
                                            case "64GB":
                                               int hrg;
                                               hrg = 91000000;
                                               System.out.println ("Harga = "+hrg);
                                               break;
                                        }
                                }
                        }
                }
                switch (m){
                    case "Apple":
                        switch (t){
                            case "Iphone 8+":
                                switch (r){
                                    case "3GB":
                                        switch (i){
                                            case "64GB":
                                               int hrg;
                                               hrg = 12500000;
                                               System.out.println ("Harga = "+hrg);
                                               break;
                                        }
                                }
                        }
                }
        }
        switch(k){
            case "SZ-EX":
                switch (m){
                    case "Sony Experia":
                        switch (t){
                            case "Z":
                                switch (r){
                                    case "3GB":
                                        switch (i){
                                            case "11.8GB":
                                               int
                                                       hrg = 70000000;
                                               System.out.println ("Harga = "+hrg);
                                               break;
                                        }
                                }
                        }
                }
                switch (m){
                    case "Sony Experia":
                        switch (t){
                            case "Z Ultra":
                                switch (r){
                                    case "2GB":
                                        switch (i){
                                            case "11GB":
                                               int hrg;
                                               hrg = 32500000;
                                               System.out.println ("Harga = "+hrg);
                                               break;
                                        }
                                }
                        }
                }
        }
      
        Scanner jumpe=new Scanner (System.in);
        System.out.print ("Jumlah Pembelian = ");
        int j=jumpe.nextInt();
      
        switch(t){
            case "S9":
                int th ;
                int hrg;
                hrg = 10000000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
        switch(t){
            case "S9+":
                int th ;
                int hrg;
                hrg = 14000000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
        switch(t){
            case "Iphone 8":
                int th ;
                int hrg;
                hrg = 91000000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
        switch(t){
            case "Iphone 8+":
                int th ;
                int hrg;
                hrg = 12500000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
        switch(t){
            case "Z":
                int th ;
                int hrg = 70000000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
        switch(t){
            case "Z Ultra":
                int th ;
                int hrg;
                hrg = 32500000;
                th = j*hrg;
                switch (j){
                    case 2:
                        double d;
                        double tb;
                        d = 0.01*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 3:
                        double d;
                        double tb;
                        d = 0.02*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 4:
                        double d;
                        double tb;
                        d = 0.03*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                switch (j){
                    case 5:
                        double d;
                        double tb;
                        d = 0.04*hrg;
                        tb = th-d ;
                System.out.println ("Total Harga = "+th);
                System.out.println ("Discount = "+d);
                System.out.println ("Total Bayar = "+tb);
                break;
                }
                break;
        }
      
      
                  
                }

        }




Semoga Bermanfaat.......



0 komentar:

Posting Komentar