import java.io.*;
import javax.swing.*;
class kurs1
{
public static void main(String[]args)
{
while(true)
{
String temp1 = JOptionPane.showInputDialog
("****** PROGRAM KURS MATA UANG ****** \n 1. Konversi mata uang dari nilai rupiah \n 2. Konversi mata uang ke nilai rupiah \n 3. Exit \n ********************* \n Masukkan Pilihan [1..3] : ");
int pilihan = Integer.parseInt(temp1);
switch (pilihan)
{
case 1:
JOptionPane.showMessageDialog(null,"1. Konversi mata uang dari nilai rupiah");
String rp1 = JOptionPane.showInputDialog("Masukkan Nilai rupiah: ");
double rupiah = Double.parseDouble(rp1);
double hasil1 = (rupiah/9500);
double hasil2 = (rupiah/13000);
double hasil3 = (rupiah/17000);
JOptionPane.showMessageDialog(null,"Nilai Rupiah = Rp. "+rupiah+"\nNilai Dollar = $ "+hasil1+"\nNilai Euro = "+hasil2+"\nNilai Poundsterling = "+hasil3);
break;
case 2:
JOptionPane.showMessageDialog(null,"1. Konversi mata uang ke nilai rupiah");
String rp11 = JOptionPane.showInputDialog("Masukkan Nilai Dollar: ");
double rupiah1 = Double.parseDouble(rp11);
String rp12 = JOptionPane.showInputDialog("Masukkan Nilai Euro: ");
double rupiah12 = Double.parseDouble(rp12);
String rp13 = JOptionPane.showInputDialog("Masukkan Nilai Poundsterling: ");
double rupiah13 = Double.parseDouble(rp13);
double hasil11 = (rupiah1*9500);
double hasil21 = (rupiah12*13000);
double hasil31 = (rupiah13*17000);
JOptionPane.showMessageDialog(null,"Nilai Dollar = $ "+rupiah1+" => Nilai tukarnya adalah Rp."+hasil11+"\nNilai Euro = "+rupiah12+" => Nilai tukarnya adalah Rp."+hasil21+"\nNilai Poundsterling = "+rupiah13+" => Nilai tukarnya adalah Rp."+hasil31);
break;
case 3:
JOptionPane.showMessageDialog(null,"3. Exit");
System.exit(0);
default :
JOptionPane.showMessageDialog(null,"Anda Salah Pilih !!!! Pilihan hanya 1-3");
}
}
}
}
makasih atas program javanya ,mbak ^^ sangat membantu ,semoga sukses selalu :D
ReplyDelete