Pembulatan Bilangan

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

package tugas4;
import javax.management.monitor.CounterMonitor;
import javax.swing.*;
/**
*
* @author Imamuddin.A.
*/
public class Tugas_4_02 {

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

}

Tinggalkan sebuah Komentar

Belum ada komentar.

Komentar RSS Lacak Balik URI Pengenal

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

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

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.