/*
* 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