Buat para pengunjung http://erikgunawan.blogspot.com, sekarang admin sudah pindah rumah ke http://www.erikgunawan.com. jadi untuk seterusnya, admin akan menulis di blog tersebut. terima kasih :)
Explore your brain. Thinking outside the box.
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; /** * @Developer : Erik Gunawan * @Nickname : EXz * @Phone : 0896 5332 0577 * @Email : erik.gunawan44@gmail.com * @Facebook : facebook.com/revolutionist.exz * @Twitter : twitter.com/_EXz */ public class Konversi { static BufferedReader br = null; public static void main(String[] args) { header(); menu(); } static void header() { System.out.println("Menu System Konversi"); System.out.println("1. Konversi Suhu"); System.out.println("2. Konversi Mata Uang"); System.out.println("3. Keluar"); System.out.print("Pilih Menu? "); } static void headerSuhu() { System.out.println("1. Celcius to Kelvin"); System.out.println("2. Celcius to Fahrenheit"); System.out.println("3. Celcius to Reamur"); System.out.println("4. Kembali ke menu utama"); System.out.print("Pilih Menu? "); } static void headerMataUang() { System.out.println("1. Rupiah to US Dolar"); System.out.println("2. Rupiah to Yen"); System.out.println("3. Rupiah to Ringgit"); System.out.println("4. Rupiah to Real"); System.out.println("5. Kembali ke menu utama"); System.out.print("Pilih Menu? "); } static void menu() { int pilihan; br = new BufferedReader(new InputStreamReader(System.in)); try { pilihan = Integer.parseInt(br.readLine()); operasi(pilihan); } catch (IOException ioe) { System.out.println("Error IOException"); } } static void operasi(int pilihan) { if (pilihan==3) { System.out.println("Anda sudah keluar"); System.exit(0); } else if (pilihan<1 data-blogger-escaped-pilihan="">3) { System.out.println("Menu yang Anda masukkan salah!"); System.exit(0); } else { try { int a; br = new BufferedReader(new InputStreamReader(System.in)); switch (pilihan) { case 1: konversiSuhu(); break; case 2: konversiMataUang(); break; default :System.out.println("Error"); break; } } catch (Exception ex) { System.out.println("Error IOException"); } } } static void konversiSuhu() { try { headerSuhu(); br = new BufferedReader(new InputStreamReader(System.in)); int pilihan = Integer.parseInt(br.readLine()); if (pilihan==4) { header(); menu(); } else if (pilihan<1 data-blogger-escaped-pilihan="">4) { System.out.println("Menu yang Anda masukkan salah!"); System.exit(0); } else { try { int suhu, hasil; System.out.print("Masukkan nilai: "); switch (pilihan) { case 1: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = 273 + suhu; System.out.println("Hasil konversi " + suhu + " C = " + hasil + " K" ); break; case 2: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = (suhu* 9/5) + 32; System.out.println("Hasil konversi " + suhu + " C = " + hasil + " F" ); break; case 3: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = suhu*4/5; System.out.println("Hasil konversi " + suhu + " C = " + hasil + " R" ); break; default :System.out.println("Error"); break; } } catch (Exception ex) { System.out.println("Error IOException"); } } header(); menu(); } catch (IOException ex) { Logger.getLogger(Konversi.class.getName()).log(Level.SEVERE, null, ex); } } static void konversiMataUang() { try { headerMataUang(); br = new BufferedReader(new InputStreamReader(System.in)); int pilihan = Integer.parseInt(br.readLine()); if (pilihan==5) { header(); menu(); } else if (pilihan<1 data-blogger-escaped-pilihan="">5) { System.out.println("Menu yang Anda masukkan salah!"); System.exit(0); } else { try { int suhu, hasil; System.out.print("Masukkan nilai uang: "); switch (pilihan) { case 1: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = suhu/10000; System.out.println("Hasil konversi Rp " + suhu + " = $ " + hasil ); break; case 2: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = suhu/5000; System.out.println("Hasil konversi Rp " + suhu + " = Yen " + hasil ); break; case 3: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = suhu/2500; System.out.println("Hasil konversi Rp " + suhu + " = Ringgit " + hasil ); break; case 4: br = new BufferedReader(new InputStreamReader(System.in)); suhu = Integer.parseInt(br.readLine()); hasil = suhu/7500; System.out.println("Hasil konversi Rp " + suhu + " = Real " + hasil ); break; case 5: header(); menu(); break; default :System.out.println("Error"); break; } } catch (Exception ex) { System.out.println("Error IOException"); } } header(); menu(); } catch (IOException ex) { Logger.getLogger(Konversi.class.getName()).log(Level.SEVERE, null, ex); } } }
import java.util.Arrays; /** * @Developer : Erik Gunawan * @Nickname : EXz * @Phone : 0896 5332 0577 * @Email : erik.gunawan44@gmail.com * @Facebook : facebook.com/revolutionist.exz * @Twitter : twitter.com/_EXz */ public class ArraySorting { public static void main(String[] args) { int arr[] = { 50, 70, 14, 35, 44, 23, 59, 4, 65 }; System.out.println("Data Array sebelum diurutkan: "); for (int i: arr) { System.out.println(i); } System.out.println(""); Arrays.sort(arr); System.out.println("Data Array setelah diurutkan: "); for (int i: arr) { System.out.println(i); } } }