faimawati(2012420154)
public class tugas4 {
double lebar;
double tinggi;
double panjang;
double kell;
double Luas;
double voll;
String Nama;
String Nama1;
String Nama2;
double pi = 3.14;
//Construktor
public tugas4 (String Nama){
this.Nama = Nama;
}
public tugas4 (double lebar,double tinggi, double panjang){
this.lebar = lebar;
this.tinggi = tinggi;
this.panjang = panjang;
}
public tugas4 (String nama1, String Nama2){
Nama1 = nama1;
this.Nama2 = Nama2;
}
public void Nama(){
System.out.println("Menghitung "+Nama);
}
public void Nama1(){
System.out.println("Termasuk " +getNama1());
}
public void semua(){
System.out.println("Lebar balok = "+lebar+" Cm"+"\nTinggi balok = " +tinggi+" Cm"+"\nPanjang balok = " +panjang+" Cm");
}
public void keliling (){
kell = 2*(panjang*lebar+panjang*tinggi+tinggi*lebar);
System.out.println("Keliling Balok = " +getkell()+" Cm3");
}
public void Luas (){
Luas=(4*(panjang+lebar+tinggi) );
System.out.println("Hasil Luas Selimut = " +getLuas()+" Cm3");
}
public void Volume (){
voll = (panjang*lebar*tinggi);
System.out.println("Hasil Volume Balok = " +getvoll()+" Cm3");
outputnya :
Posted by 22.27 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar