Tuesday, 2 October 2012

perintah masukan showinputdialog

showinputdialog

import javax.swing.JOptionPane;

String <nama var> = JOptionPane.showInputDialog(teks);

JOptionPane.showMessageDialog(null, Nilai Anda);




package perintah_masukan;

import javax.swing.JOptionPane ;
public class showinputdialog {

   
    public static void main(String[] args)
    {
      String Nama_Peserta = JOptionPane.showInputDialog("Nama Peserta");
      String nilai1 = JOptionPane.showInputDialog("nilai1");
      int n1= Integer.parseInt(nilai1);
      String Nilai2 = JOptionPane.showInputDialog("Nilai 2");
      int n2 =Integer.parseInt(Nilai2);

      double nilairata = (n1+n2)*0.5 ;
 //kalo double pake 0.5 tapi kalo pake float pake /2
JOptionPane.showMessageDialog(null,"Nama Peserta = "+Nama_Peserta +
        "\nNilai1 ="+n1+" \nNilai 2 ="+n2+" \nNilai Rata-Rata = " + nilairata);
    }

}









package perintah_masukan;
import javax.swing.JOptionPane ;
public class Latihan_showinputdialog {

  

    public static void main(String[] args)
    {
      String Nama_Pegawai = JOptionPane.showInputDialog("Nama Pegawai");
      String gajipokok = JOptionPane.showInputDialog("Gaji Pokok");
      int gjp= Integer.parseInt(gajipokok);
      String jumlahanak = JOptionPane.showInputDialog("Jumlah Anak");
      int ja =Integer.parseInt(jumlahanak);

      double ta = (0.1 * gjp)* ja ;
      double ti = 0.05 * gjp;
      double tb = (1+1+ja)*25000;
      double gk = gjp+ta+ti+tb;

      JOptionPane.showMessageDialog(null,"Nama Peserta = "+Nama_Pegawai +
     "\nGaji pokok ="+gjp+" \nTunjangan Anak ="+ta+" \nTunjangan Istri ="+ti+
"\nTunjangan beras ="+tb+" \nGaji Kotor ="+gk+" ","Hasil nya",JOptionPane.INFORMATION_MESSAGE);
jika tidak ingin ada simbol nya joptionpane nya PLAIN_MESSAGE
    }

}

Perhatian: Yuk Baca Artikel bagus di Nurul Musthofa

Artikel Terkait

1 comment:

  1. tes emoticon .
    :k1 :k2 :k3 :k4 :k5 :k6 :k7 :k8 :k9

    :a1 :a2 :a2 :a3 :a4 :a5 :a6 :a7 :a8 :a9

    :b1 :b2 :b3 :b4 :b5

    ReplyDelete

 

Network

Pesan

Semoga situs ini bermanfaat