public class lingkaran {
public double pi=3.14, kell, vol;
public float luas;
public int r, t;
String alas;
public void hitung (double Temp){
kell=2*pi*r;
}
public void hitung (float Temp, double volume){
luas=(float) (pi*(r*r));
vol=luas*t;
}
public void hitung (){
System.out.println("Keliling Alas: "+kell);
System.out.println("Luas Alas: "+luas);
System.out.println("Volume Tabung: "+vol);
}
public int getr(){
return r;
}
public void setr(int temp){
r=temp;
}
public int gett(){
return t;
}
public void sett(int temp){
t=temp;
}
public double getkell(){
return kell;
}
public void setkell(double temp){
kell=temp;
}
public float getluas(){
return luas;
}
public void setluas(float temp){
luas=temp;
}
public double getvol(){
return vol;
}
public void setvol(double temp){
vol=temp;
}
public static void main(String[] args) {
// TODO code application logic here
lingkaran x=new lingkaran();
x.setr(Integer.parseInt(JOptionPane.showInputDialog(null,"jari-jari alas: ")));
x.sett(Integer.parseInt(JOptionPane.showInputDialog(null,"tinggi tabung: ")));
x.hitung(x.getkell());
x.hitung(x.getluas(),x.getvol());
x.hitung();
Nama: Ria Suryani
NIM: 2012420033
Kelas: A
Posted by 01.06 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar