Sabtu, 20 April 2013

Contoh Codingan Membuat Rumus Persegi Panjang di JAVA


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;
import javax.swing.JOptionPane;
/**
 *
 * @author Toshiba
 */
public class LuasPersegi {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
     
        //Input
        String input1 = JOptionPane.showInputDialog("Inputkan Pajang Persegi");
        int p = Integer.parseInt(input1);
        String input2 = JOptionPane.showInputDialog("Inputkan Lebar Persegi");
        int l = Integer.parseInt(input2);
 
        //Prosess
        int L = p*l;
     
        //output
        System.out.println("Panjang Persegi = "+p);
        System.out.println("Lebar Persegi = "+l);
        System.out.println("Luas Persegi = " +L);
    }
}

INPUTAN










OUTPUTAN

Kalau kurang jelas, silahkan download filenya disini gan :D

THANKS, semoga bermanfaat :D



0 komentar:

Posting Komentar

 
Copyright © . Selamat Datang Di Blog Bagus Dermawan - Posts · Comments
Theme Template by BTDesigner · Powered by Blogger