Sistem Akademik
Nama : Sherly Rosa Anggraeni
NRP : 05111740000018
Kelas : PBO-A
1. Database
import java.util.ArrayList;
/**
* Sherly Rosa Anggraeni
* 05111740000018
* PBO-A
*/
public class database
{
private ArrayList<mahasiswa> mhs;
private ArrayList<dosen> dsn;
private ArrayList<pegawai> peg;
public database()
{
mhs = new ArrayList<mahasiswa>();
dsn = new ArrayList<dosen>();
peg = new ArrayList<pegawai>();
}
public void addMahasiswa(mahasiswa theMhs)
{
mhs.add(theMhs);
}
public void deleteMahasiswa(mahasiswa theMhs)
{
mhs.remove(theMhs);
}
public void addDosen(dosen theDsn)
{
dsn.add(theDsn);
}
public void deleteDosen(dosen theDsn)
{
dsn.remove(theDsn);
}
public void addPegawai(pegawai thePeg)
{
peg.add(thePeg);
}
public void deletePegawai(pegawai thePeg)
{
peg.remove(thePeg);
}
public void listMahasiswa()
{
for(mahasiswa m : mhs)
{
m.printd();
System.out.println();
}
}
public void listDosen()
{
for(dosen d : dsn)
{
d.printd();
System.out.println();
}
}
public void listPegawai()
{
for(pegawai p : peg)
{
p.printd();
System.out.println();
}
}
}
2. ID
/**
* Sherly Rosa Anggraeni
* 05111740000018
* PBO-A
*/
public class id
{
private String nama;
private String alamat;
private int umur;
public id(String iNama, String iAlamat, int iUmur)
{
nama = iNama;
alamat = iAlamat;
umur = iUmur;
}
public void print()
{
System.out.println("Nama:" + nama);
System.out.println("Alamat:" + alamat);
System.out.println("Umur:" + umur);
}
public String getNama()
{
return nama;
}
}
3. Pegawai
import java.util.ArrayList;
/**
* Sherly Rosa Anggraeni
* 05111740000018
* PBO-A
*/
public class pegawai extends id
{
private String NID;
private ArrayList<buku> bk;
public pegawai(String iNama, String iNID, String iAlamat, int iUmur)
{
super(iNama, iAlamat, iUmur);
NID = iNID;
}
public String getNID()
{
return NID;
}
public void MeminjamBuku(buku theBuku)
{
bk.add(theBuku);
}
public void PengembalianBuku(buku theBuku)
{
bk.remove(theBuku);
}
public void print()
{
System.out.println("NID:" + NID);
super.print();
for(buku BUKU : bk)
{
System.out.println("Judul Buku: "+ BUKU.getBuku());
}
}
public void printd()
{
System.out.println("NID:" + NID);
super.print();
}
}
4. Dosen
import java.util.ArrayList;
/**
* Sherly Rosa Anggraeni
* 05111740000018
*/
public class dosen extends id
{
private String NIP;
private ArrayList<buku> bk;
public dosen(String iNama, String iNIP, String iAlamat, int iUmur)
{
super(iNama, iAlamat, iUmur);
NIP = iNIP;
}
public String getNIP()
{
return NIP;
}
public String getDosen()
{
return super.getNama();
}
public void MeminjamBuku(buku theBuku)
{
bk.add(theBuku);
}
public void PengembalianBuku(buku theBuku)
{
bk.remove(theBuku);
}
public void print()
{
System.out.println("NIP:" + NIP);
super.print();
for(buku BUKU : bk)
{
System.out.println("Judul Buku: "+ BUKU.getBuku());
}
}
public void printd()
{
System.out.println("NIP:" + NIP);
super.print();
}
}
5. Mahasiswa
import java.util.ArrayList;
/**
* Sherly Rosa Anggraeni
* 05111740000018
*/
public class mahasiswa extends id
{
private String NRP;
private ArrayList<matkul> m_k;
private ArrayList<buku> bk;
public mahasiswa(String iNama, String iNRP, String iAlamat, int iUmur)
{
super(iNama, iAlamat, iUmur);
NRP = iNRP;
m_k = new ArrayList<matkul>();
bk = new ArrayList<buku>();
}
public void addMK(matkul theMK)
{
m_k.add(theMK);
}
public void dropMK(matkul theMK)
{
m_k.remove(theMK);
}
public void MeminjamBuku(buku theBuku)
{
bk.add(theBuku);
}
public void PengembalianBuku(buku theBuku)
{
bk.remove(theBuku);
}
public void print()
{
System.out.println("NRP:" + NRP);
super.print();
for(matkul matakuliah : m_k)
{
System.out.println("Mata Kuliah: "+ matakuliah.getMatkul());
System.out.println("Kelas: "+ matakuliah.getKls());
System.out.println("Dosen: "+ matakuliah.getDsn());
}
for(buku BUKU : bk)
{
System.out.println("Judul Buku: "+ BUKU.getBuku());
}
}
public void printd()
{
System.out.println("NRP:" + NRP);
super.print();
}
}
6. Buku
/**
* Sherly Rosa Anggraeni
* 05111740000018
*/
public class buku
{
private String judul;
private String penulis;
public buku(String bBuku, String pPenulis)
{
judul = bBuku;
penulis = pPenulis;
}
public String getBuku()
{
return judul;
}
}
7. Mata Kuliah
/**
* Sherly Rosa Anggraeni
* 05111740000018
*/
public class matkul
{
private int kode;
private String mata_kuliah;
private int jum_sks;
private kelas kls;
private String kl;
private String ds;
public matkul(int kd, String mk, int sks)
{
kode = kd;
mata_kuliah = mk;
jum_sks = sks;
}
public String getMatkul()
{
return mata_kuliah;
}
public void addKelas(kelas KLS)
{
kl = KLS.getKelas();
}
public String getKls()
{
return kl;
}
public void addDosen(dosen dsn)
{
ds = dsn.getDosen();
}
public String getDsn()
{
return ds;
}
public void print()
{
System.out.println("Kode:" + kode);
System.out.println("Mata Kuliah:" + mata_kuliah);
System.out.println("SKS:" + jum_sks);
}
}
8. Kelas
/**
* Sherly Rosa Anggraeni
* 05111740000018
*/
public class kelas
{
private String ruang;
public kelas(String kRuang)
{
ruang = kRuang;
}
public String getKelas()
{
return ruang;
}
}
Tidak ada komentar:
Posting Komentar