Belajar Java : Menghitung Luas dan Keliling Lingkaran


class Lingkaran {
public static void main(String[] args) {
String inputanJarijari;
double jarijari,luas, keliling;

System.out.println(“Program Luas + Keliling Lingkaran”);
System.out.println(“**********************”);

System.out.print(“Masukkanjarijari: “);
inputanJarijari = Baca.bacaString();
jarijari= Double.valueOf(inputanJarijari).doubleValue();

luas = (3.14*jarijari*jarijari);
System.out.println(“Luas Lingkaran: “+luas+”cm”);

keliling = (2*3.14*jarijari*jarijari);
System.out.println(“Keliling Lingkaran: “+ keliling +”cm”);

}
}

2 thoughts on “Belajar Java : Menghitung Luas dan Keliling Lingkaran

  1. ngeri yu wkwkwkkkk….
    yang diatas masih kurang import javax.io;

    import javax.swing.*;
    public class jari2{
    String jari2 = JOptionPane.showInputDialog(“Masukkan Jari2 : “);
    Integer jari = Double.valueOf(jari2);
    int luas = Math.Phi*jari*jari;
    int keliling = 2*Math.phi*jari*jari;
    JOptionPane.showMessageDialog(“luas lingkaran = “+String.parseInt(luas)+”\n”+”Keliling : “+String.parseInt(keliling));
    }

    hahahaaaa

Leave a Reply

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 / Change )

Twitter picture

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

Facebook photo

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

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s