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 void alas(){
System.out.println(alas);
}
public lingkaran (int Temp, int tinggi){
r=Temp;
t=tinggi;
}
public lingkaran (String Temp){
alas=Temp;
}
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 a=new lingkaran (Integer.parseInt(JOptionPane.showInputDialog(null,"jari-jari: ")),Integer.parseInt(JOptionPane.showInputDialog(null,"tinggi: ")));
a.hitung(a.getkell());
a.hitung(a.getluas(), a.getvol());
a.hitung();
lingkaran b=new lingkaran("alas dari tabung adalah lingkaran");
b.alas();
}
}
Nama: Ria Suryani
NIM: 2012420033
Kelas: A
Posted by 01.26 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar