UTS

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { String[][] listProducts= { {"ID001", "Eiger", "Sendal Gunung", "150000"}, {"ID002", "Eiger", "Sepatu Gunung", "375000"}, {"ID003", "Arei", "Tali Prusik", "50000"}, {"ID004", "Consina", "Tas Carrier", "835000"}, {"ID005", "Eiger", "Tas Laptop", "450000"}, {"ID006", "Arei", "Ikat Pinggang", "76000"}, {"ID007", "Arei", "Sepatu Gunung", "487000"}, {"ID008", "Consina", "Sepatu Gunung", "340000"}, {"ID009", "Consina", "Jaket Gunung", "299000"}, {"ID0010", "Eiger", "Jaket Gunung", "598000"}, }; search(listProducts, "Jaket Gunung" , "Consina"); } public static void search(String[][] listData, String product, String brand){ //jika product dan brand terisi, maka tampilkan 1 produk yang dicari int getIndex = -1; for(int i = 0; i < listData.length; i++){ if(//[TUGAS 1] koding disini )){ getIndex = i; break; } } if(getIndex != -1){ //[TUGAS 2] koding disini } else { //jika produk tidak diisi maka pencarian hanya berdasarkan brand if(product == ""){ if (brand != ""){ for(int i = 0; i < listData.length; i++){ if(listData[i][1].equals(brand)){ //[TUGAS 3] koding disini } } } } //jika brand tidak diisi maka pencarian hanya berdasarkan product if(brand == ""){ if(product != ""){ for(int i = 0; i < listData.length; i++){ if(listData[i][2].equals(product)){ //[TUGAS 4] koding disini } } } } //jika 22nya tidak diisi if(product == "" && brand == ""){ System.out.println("Isikan Data Brand dan Product yang mau dicari!"); } } } }
Editor Settings
Theme
Key bindings
Full width
Lines