diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/IBerprestasi.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/IBerprestasi.java new file mode 100644 index 0000000..40f95ae --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/IBerprestasi.java @@ -0,0 +1,6 @@ +package interfacelatihan; + +public interface IBerprestasi { + public abstract void menjuaraiKompetisi(); + public abstract void membuatPublikasiIlmiah(); +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/ICumlaude.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/ICumlaude.java new file mode 100644 index 0000000..30053fd --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/ICumlaude.java @@ -0,0 +1,6 @@ +package interfacelatihan; + +public interface ICumlaude { + public abstract void lulus(); + public abstract void meraihIPKTinggi(); +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/Interfacemain.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Interfacemain.java new file mode 100644 index 0000000..91bb559 --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Interfacemain.java @@ -0,0 +1,17 @@ +package interfacelatihan; + +public class Interfacemain { + public static void main(String[] args) { + Rektor pakRektor = new Rektor(); + +// Mahasiswa mahasiswaBiasa = new +// Mahasiswa("Charlie"); + Sarjana sarjanaCumlaude = new Sarjana("Dini"); + PascaSarjana masterCum = new PascaSarjana("Elok"); + +// PascaSarjana("Elok"); + // pakRektor.beriSertifikatCumlaude(mahasiswaBiasa); + // pakRektor.beriSertifikatMawapres(sarjanaCum); + pakRektor.beriSertifikatMawapres(masterCum); +} +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/Mahasiswa.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Mahasiswa.java new file mode 100644 index 0000000..627281b --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Mahasiswa.java @@ -0,0 +1,14 @@ +package interfacelatihan; + +public class Mahasiswa { + protected String nama; + + public Mahasiswa(String nama){ + this.nama = nama; + } + + public void kuliahDikampus(){ + System.out.println("Aku mahasiswa, namaku " + this.nama); + System.out.println("Aku berkuliah dikampus."); + } +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/PascaSarjana.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/PascaSarjana.java new file mode 100644 index 0000000..7c49b7c --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/PascaSarjana.java @@ -0,0 +1,27 @@ +package interfacelatihan; + +public class PascaSarjana extends Mahasiswa implements ICumlaude, IBerprestasi{ + public PascaSarjana(String nama){ + super(nama); + } + + @Override + public void lulus(){ + System.out.println("Aku sudah menyelesaikan TESIS"); + } + + @Override + public void meraihIPKTinggi(){ + System.out.println("IPK-ku lebih dari 3,71"); + } + + @Override + public void menjuaraiKompetisi(){ + System.out.println("Ssaya telah menjuarai kompetisi INTERNASIONAL"); + } + + @Override + public void membuatPublikasiIlmiah(){ + System.out.println("Saya menerbitkan artikel di jurnal INTERNASIONAL"); + } +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/Rektor.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Rektor.java new file mode 100644 index 0000000..5e256cb --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Rektor.java @@ -0,0 +1,20 @@ +package interfacelatihan; + +public class Rektor { + public void beriSertifikatCumlaude(ICumlaude mahasiswa){ + System.out.println("Saya REKTOR, memberikan sertifikat cumlaude"); + System.out.println("Selamat! bagaimana anda bisa cumlaude?"); + + mahasiswa.lulus(); + mahasiswa.meraihIPKTinggi(); + System.out.println("------------------------------------------"); + } + + public void beriSertifikatMawapres(IBerprestasi mahasiswa){ + System.out.println("Saya REKTOR, memberikan sertifikat MAWAPRESS"); + System.out.println("Selamat! bagaimana anda bisa berprestasi?"); + mahasiswa.menjuaraiKompetisi(); + mahasiswa.membuatPublikasiIlmiah(); + System.out.println("------------------------------------------"); + } +} diff --git a/1941720240_Addina Nurul Mawaddah/interfacelatihan/Sarjana.java b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Sarjana.java new file mode 100644 index 0000000..3ba346e --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/interfacelatihan/Sarjana.java @@ -0,0 +1,17 @@ +package interfacelatihan; + +public class Sarjana extends Mahasiswa implements ICumlaude{ + public Sarjana(String nama){ + super(nama); + } + + @Override + public void lulus(){ + System.out.println("Aku sudah menyelesaikan SKIRPSI"); + } + + @Override + public void meraihIPKTinggi(){ + System.out.println("IPK-ku lebih dari 3,51"); + } +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Binatang.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Binatang.java new file mode 100644 index 0000000..2fbd994 --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Binatang.java @@ -0,0 +1,29 @@ +package tugasinterface; + +public abstract class Binatang { + protected String nama; + protected int jmlKaki; + + public Binatang(String nama, int jmlKaki) { + this.nama = nama; + this.jmlKaki = jmlKaki; + } + + public String getNama() { + return nama; + } + + public void setNama(String nama) { + this.nama = nama; + } + + public int getJmlKaki() { + return jmlKaki; + } + + public void setJmlKaki(int jmlKaki) { + this.jmlKaki = jmlKaki; + } + + public abstract void displayBinatang(); +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Gorilla.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Gorilla.java new file mode 100644 index 0000000..3cf292a --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Gorilla.java @@ -0,0 +1,31 @@ +package tugasinterface; + +public class Gorilla extends Binatang implements Karnivora, Herbivora{ + private String suara; + private String warnaBulu; + + public Gorilla(String suara, String warnaBulu, String nama, int jmlKaki) { + super(nama, jmlKaki); + this.suara = suara; + this.warnaBulu = warnaBulu; + } + + @Override + public void displayMakan() { + System.out.println("Jenis : Karnivora + Herbivora"); + System.out.println("Makanan : Daging + Tumbuhan"); + } + + @Override + public void displayBinatang(){ + System.out.println("Nama : " + this.nama); + System.out.println("Jumlah Kaki : " + this.jmlKaki); + } + + public void diplayData(){ + System.out.println("Suara : " + this.suara); + System.out.println("Warna Bulu : " + this.warnaBulu); + } + + +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Herbivora.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Herbivora.java new file mode 100644 index 0000000..bc16b22 --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Herbivora.java @@ -0,0 +1,5 @@ +package tugasinterface; + +public interface Herbivora { + public abstract void displayMakan(); +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Karnivora.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Karnivora.java new file mode 100644 index 0000000..aaa7b4c --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Karnivora.java @@ -0,0 +1,5 @@ +package tugasinterface; + +public interface Karnivora { + public abstract void displayMakan(); +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Keledai.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Keledai.java new file mode 100644 index 0000000..5115950 --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Keledai.java @@ -0,0 +1,30 @@ +package tugasinterface; + +public class Keledai extends Binatang implements Herbivora{ + private String suara; + private String warnaBulu; + + public Keledai(String suara, String warnaBulu, String nama, int jmlKaki) { + super(nama, jmlKaki); + this.suara = suara; + this.warnaBulu = warnaBulu; + } + + @Override + public void displayMakan() { + System.out.println("Jenis : Herbivora"); + System.out.println("Makanan : Tumbuhan"); + } + + @Override + public void displayBinatang(){ + System.out.println("Nama : " + this.nama); + System.out.println("Jumlah Kaki : " + this.jmlKaki); + } + + public void diplayData(){ + System.out.println("Suara : " + this.suara); + System.out.println("Warna Bulu : " + this.warnaBulu); + } + +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Mainbinatang.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Mainbinatang.java new file mode 100644 index 0000000..105ef2e --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Mainbinatang.java @@ -0,0 +1,24 @@ +package tugasinterface; + +public class Mainbinatang { + public static void main(String[] args) { + Keledai kl = new Keledai("hehehehe", "Abu-abu", "Keledai", 4); + Gorilla gl = new Gorilla("haaum hauumm", "Hitam Manis", "Gorilla", 4); + Singa sg = new Singa("Roarrr roarrr", "Coklat", "Singa", 4); + + kl.displayMakan(); + kl.displayBinatang(); + kl.diplayData(); + System.out.println(""); + + gl.displayMakan(); + gl.displayBinatang(); + gl.diplayData(); + System.out.println(""); + + sg.displayMakan(); + sg.displayBinatang(); + sg.diplayData(); + + } +} diff --git a/1941720240_Addina Nurul Mawaddah/tugasinterface/Singa.java b/1941720240_Addina Nurul Mawaddah/tugasinterface/Singa.java new file mode 100644 index 0000000..1df2b89 --- /dev/null +++ b/1941720240_Addina Nurul Mawaddah/tugasinterface/Singa.java @@ -0,0 +1,30 @@ +package tugasinterface; + +public class Singa extends Binatang implements Karnivora{ + private String suara; + private String warnaBulu; + + public Singa(String suara, String warnaBulu, String nama, int jmlKaki) { + super(nama, jmlKaki); + this.suara = suara; + this.warnaBulu = warnaBulu; + } + + @Override + public void displayMakan() { + System.out.println("Jenis : Karnivora"); + System.out.println("Makanan : Daging"); + } + + @Override + public void displayBinatang(){ + System.out.println("Nama : " + this.nama); + System.out.println("Jumlah Kaki : " + this.jmlKaki); + } + + public void diplayData(){ + System.out.println("Suara : " + this.suara); + System.out.println("Warna Bulu : " + this.warnaBulu); + } + +}