Source Code :
import javax.swing.*;
public class MencariLuasSegitiga {
int alas,tinggi;
float luas;
double Sis;
double Kel;
public void input()
{
String x;
x = JOptionPane.showInputDialog("Masukkan Alas ");
alas = Integer.parseInt(x);
x= JOptionPane.showInputDialog("Masukkan Tinggi ");
tinggi = Integer.parseInt(x);
}
public void proses()
{
luas = (alas*tinggi)/2;
Sis = Math.sqrt(Math.pow(alas,2)+ Math.pow(tinggi,2));
Kel = alas+Sis+tinggi;
}
public static void main(String args[])
{
Segitiga output = new Segitiga();
output.input();
output.proses();
float hasil = output.luas;
double miring = output.Sis;
double keliling = output.Kel;
JOptionPane.showMessageDialog(null,"Luas segitiga "+hasil +"cm");
JOptionPane.showMessageDialog(null,"Sisi Miring "+miring +"cm");
JOptionPane.showMessageDialog(null,"Keliling "+keliling+"cm");
}
}
Outputnya :
Monday, April 1, 2013
Program Mencari Luas Segitiga
Silahkan Copas Gannnn,,,,
Tapi Tolong Jangan Lupa Komentarnya yy gann,,,
0 comments:
:)) :)] ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} ~x( :-t b-( :-L x( =))
Post a Comment