Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. import java.util.ArrayList;
  2. public class Mahasiswa extends entitas
  3. {
  4. private String NRP;
  5. private ArrayList<Matkul> m_k;
  6. private ArrayList<Book> buku;
  7. public Mahasiswa(String Nama, int Umur, String Alamat, String nrp)
  8. {
  9. super(Nama,Umur,Alamat);
  10. NRP = nrp;
  11. m_k = new ArrayList<Matkul>();
  12. buku = new ArrayList<Book>();
  13. }
  14. public String getNRP()
  15. {
  16. return NRP;
  17. }
  18. public void addMK(Matkul thematkul)
  19. {
  20. m_k.add(thematkul);
  21. }
  22. public void dropMatkul(Matkul thematkul)
  23. {
  24. m_k.remove(thematkul);
  25. }
  26. public void meminjamBuku(Book book)
  27. {
  28. buku.add(book);
  29. }
  30. public void kembalikanBuku(Book book)
  31. {
  32. buku.remove(book);
  33. }
  34. public void print()
  35. {
  36. super.display();
  37. System.out.println("NRP :" +NRP);
  38. for(Matkul matakuliah : m_k)
  39. {
  40. System.out.println("Mata Kuliah :" +matakuliah.getMatkul());
  41. System.out.println("Kelas :" +matakuliah.getKls());
  42. System.out.println("Dosen :" +matakuliah.getNamaDosen());
  43. }
  44. for(Book bukuu : buku)
  45. {
  46. System.out.println("Buku yang dipinjam :" +bukuu.getJudul());
  47. }
  48. }
  49. /*public void print()
  50. {
  51. super.display();
  52. System.out.println("NRP :" +NRP);
  53. } */
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement