Senin, 21 September 2015

Memasukan input dalam netbeans

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tugas_cio;
import javax.swing.JOptionPane;
/**
 *
 * @author ASUS X550Z
 */
public class Tugas_cio {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
         String input1;
        String input2;
       
        int Harga,Jumlah;
        int Biaya;
       
        input1= JOptionPane.showInputDialog("masukkan Harga");
        input2= JOptionPane.showInputDialog("masukkan Jumlah");
       
        Harga= Integer.parseInt(input1);
        Jumlah= Integer.parseInt(input2);
       
        Biaya= Harga*Jumlah;
       
        JOptionPane.showMessageDialog(null,"Biaya yang dibayar Rp."+Biaya,"Biaya",JOptionPane.PLAIN_MESSAGE);
    }
   
}



Tidak ada komentar:

Posting Komentar