Tugas Laporan 3

Sebelumnya.. Class Lingkaran dan Class Coba

Mengimplementasikan  UML  class  diagram  dalam  program  untuk  class Mahasiswa

  • Listing program

Implementasi UML :

public class Mahasiswa{
public int stb;
public String nama;
public Mahasiswa(int i, String n){
stb=i;
nama=n;
}
public int getStb(){
return stb;
}
public String getNama(){
return nama;
}
}

Program untuk menguji UML :

public class laporan_2{
public static void main(String args[]){
Mahasiswa mhs=new Mahasiswa(130204011,”Boy”);
System.out.println(“Stambuk: “+mhs.getStb());
System.out.println(“Nama : “+mhs.getNama());
}
}

  • Melalui Command prompt

class Mahasiswa{

public int stb;

public String nama;

public Mahasiswa(int i, String n){

stb=i;

nama=n;

}

public int getStb(){

return stb;

}

public String getNama(){

return nama;

}

}

public class laporan_2{

public static void main(String args[]){

Mahasiswa mhs=new Mahasiswa(130204011,”Boy”);

System.out.println(“Stambuk: “+mhs.getStb());

System.out.println(“Nama : “+mhs.getNama());

}

}

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