Coding :
public class Radio{
public String Nama;
public Boolean on = false;
public int volume=0;
public String ret;
public Radio() {
}
public void namaRadio(){
System.out.println("\nObjek Radio "+Nama+" Berhasil Di buat");
}
public void nyalakan_radio(){
if (on==true)
ret="Radio Nyala";
else
ret="Radio Mati";
if (volume > 0)
ret +=" Dengan Volume "+volume;
System.out.println(ret);
}
public static void main(String[] args) {
Radio genfm = new Radio();
genfm.Nama="Gen FM";
genfm.on=true;
genfm.volume=10;
genfm.namaRadio();
genfm.nyalakan_radio();
Radio unitomofm=new Radio();
unitomofm.Nama="unitomo FM";
unitomofm.on=false;
unitomofm.volume=0;
unitomofm.namaRadio();
unitomofm.nyalakan_radio();
}
}
Output :
Download
[ Click Here ]
TUGAS 2 :
Nama : Irwansyah
NIm : 2012420052
Kelas : A
Posted by 12.21 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar