Menghitung Luas Segitiga Menggunakan JOptionPane di Java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package programluassegitiga;
import javax.swing.*;
/**
*
* @author Angga
*/
public class LuasSegitiga {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println(“Program Menghitung luas segitiga :”);

String alas = “”;
alas = JOptionPane.showInputDialog(“Ayuk Masukkan alasnya : “);
int a=Integer.parseInt(alas);

String tinggi = “”;
tinggi = JOptionPane.showInputDialog(“Ayuk Masukkan tingginya : “);
int t=Integer.parseInt(tinggi);

System.out.println (“Alas = “+(a));
System.out.println (“Tinggi = “+(t));
System.out.println (“Luasnya = “+(a*t/2));
System.out.println (“Created By ANGGA”);

}

}

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

w

Connecting to %s