Pada kesempatan kali ini saya akan mencoba membuat sistem integra. Disini saya nantinya akan membuat 8 class dengan menggunakan metode inheritance. Berikut adalah penggambaran classnya dengan menggunakan Blue J.
Berikut adalah isi dari setiap objectnya.
Berikut adalah source code tiap classnya.
- Database
/** * Write a description of class Database here. * * @author (your name) * @version (a version number or a date) */ import java.util.ArrayList; public class Database { private ArrayList<ID>id; public Database() { id=new ArrayList<ID>(); } public void addID(ID theID) { id.add(theID); } public void list() { for (ID id:id){ id.print(); System.out.println(); } } }
- ID
/** * Write a description of class ID here. * * @author (your name) * @version (a version number or a date) */ public class ID { public String status; public String kode; public String nama; public ID(String theStatus, String theKode, String theNama) { status=theStatus; kode=theKode; nama=theNama; } public void print() { System.out.println(status); System.out.println("ID: " +kode); System.out.println("Nama: "+nama); } }
- Mahasiswa
/** * Write a description of class Mahasiswa here. * * @author (your name) * @version (a version number or a date) */ import java.util.ArrayList; public class Mahasiswa extends ID { private int semester; private int sks; private double ipk; private ArrayList<MataKuliah> matkul; private ArrayList<Buku> book; public Mahasiswa(String theStatus, String theKode, String theNama, int theSemester, int theSKS, double theIPK) { super(theStatus, theKode, theNama); semester=theSemester; sks=theSKS; ipk=theIPK; matkul=new ArrayList<MataKuliah>(); book=new ArrayList<Buku>(); } public void addMatkul(MataKuliah theMatkul) { matkul.add(theMatkul); } public void dropMatkul(MataKuliah theMatkul) { matkul.remove(theMatkul); } public void PinjamBuku(Buku theBook) { book.add(theBook); } public void KembaliBuku(Buku theBook) { book.remove(theBook); } public int getSemester() { return semester; } public int getSKS() { return sks; } public double getIPK() { return ipk; } public String getMahasiswa() { return this.nama; } }
- Pegawai
/** * Write a description of class Pegawai here. * * @author (your name) * @version (a version number or a date) */ import java.util.ArrayList; public class Pegawai extends ID { private ArrayList<MataKuliah> matkul; private ArrayList<Buku> book; public Pegawai(String theStatus, String theKode, String theNama) { super(theStatus, theKode, theNama); book=new ArrayList<Buku>(); } public void PinjamBuku(Buku theBook) { book.add(theBook); } public void KembaliBuku(Buku theBook) { book.remove(theBook); } public String getPegawai() { return this.nama; } }
- Dosen
/** * Write a description of class Dosen here. * * @author (your name) * @version (a version number or a date) */ import java.util.ArrayList; public class Dosen extends ID { private ArrayList<MataKuliah> matkul; private ArrayList<Buku> book; public Dosen(String theStatus, String theKode, String theNama) { super(theStatus, theKode, theNama); matkul=new ArrayList<MataKuliah>(); book=new ArrayList<Buku>(); } public void addMatkul(MataKuliah theMatkul) { matkul.add(theMatkul); } public void PinjamBuku(Buku theBook) { book.add(theBook); } public void KembaliBuku(Buku theBook) { book.remove(theBook); } public String getDosen() { return this.nama; } }
- Buku
/** * Write a description of class Buku here. * * @author (your name) * @version (a version number or a date) */ public class Buku { private String kode; private String judul; private String penulis; public Buku(String theKode, String theJudul, String thePenulis) { kode=theKode; judul=theJudul; penulis=thePenulis; } public String getBuku() { return judul; } }
- MataKuliah
/** * Write a description of class MataKuliah here. * * @author (your name) * @version (a version number or a date) */ public class MataKuliah { private int kode; private String nama; private int sks; private String waktu; private String ruang; private String dosen; public MataKuliah(int theKode, String theNama, int theSKS, String theTime) { kode=theKode; nama=theNama; sks=theSKS; waktu=theTime; } public void addKelas(Kelas kelas) { ruang=kelas.getKelas(); } public void addDosen(Dosen dsn) { dosen=dsn.getDosen(); } public String getMataKuliah() { return nama; } public String getKelas() { return ruang; } public String getDosen() { return dosen; } public void print() { System.out.println("Kode :" + kode); System.out.println("Mata Kuliah :" + nama); System.out.println("SKS :" + sks); System.out.println("Dosen :" + dosen); } }
- Kelas
/** * Write a description of class Kelas here. * * @author (your name) * @version (a version number or a date) */ public class Kelas { private String ruang; public Kelas(String theRoom) { ruang=theRoom; } public String getKelas() { return ruang; } }
Berikut adalah isi dari setiap objectnya.
how to make money from casino games and earn cash at
BalasHapusThe หาเงินออนไลน์ goal of making money is to earn as much money as possible 김제 출장마사지 on your 부산광역 출장안마 own 전라남도 출장안마 casino game. If you've ever thought 경산 출장마사지 you might earn