Tugas Pendahuluan 3

class Lingkaran {

double jari;

void isijari(double r){

jari=r;

}

double getLuas(){

return (3.14 * jari * jari);

}

double getKeliling(){

return (2 * 3.14 * jari);

}

public void getHasil (){

System.out.println(“Luas = “+getLuas());

System.out.println(“Keliling = “+getKeliling());

}

}

public class coba{

public static void main (String args[]){

Lingkaran a=new Lingkaran();

a.isijari(10.0);

a.getHasil();

}

}

Selanjutnya.. Mengimplementasikan  UML  class  diagram  dalam  program  untuk  class Mahasiswa

Tinggalkan Komentar

Please log in using one of these methods to post your comment:

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