oViE'

Tuesday, November 18, 2008

Tugas aLgo ke-4

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

package pertemuan4;
import javax.management.monitor.CounterMonitor;
import javax.swing.*;
/**
*
* @author oViE
*/
public class Tugas4 {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String input;
double alas;
double tinggi;
double luas,kel, miring;
input = JOptionPane.showInputDialog(”Alas”);
alas = Integer.parseInt(input);
input = JOptionPane.showInputDialog(”Tinggi”);
tinggi = Integer.parseInt(input);

luas = alas * tinggi/2;
JOptionPane.showMessageDialog(null, “Luas ” + luas);

//Keliling segitiga
double kuadrat = (Math.pow(alas, 2))+(Math.pow(tinggi, 2));
miring = Math.sqrt(kuadrat);
kel = (alas+tinggi+miring);
double bulat = Math.round(kel);
JOptionPane.showMessageDialog(null, “Keliling ” + kel);
JOptionPane.showMessageDialog(null, “Keliling ” + bulat);
System.exit(0);
// TODO code application logic here
}

}
posted by oVi b9Tz at 4:00 AM

0 Comments:

Post a Comment

<< Home