0% found this document useful (0 votes)
39 views3 pages

Nama: Rafif Mallow Dwi Syamsoe NPM: 15183207081 Prodi: PTI - 5B Tugas Akhir / Uas Class Wali

The document contains Java code that defines classes for individuals, teachers, and students. The Individual class stores name, address, and age attributes. The Teacher and Student classes extend the Individual class and add additional attributes for an ID number. The code includes getter and setter methods to access the attributes. A Main class instantiates objects of each class and calls their info methods to output the attribute values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views3 pages

Nama: Rafif Mallow Dwi Syamsoe NPM: 15183207081 Prodi: PTI - 5B Tugas Akhir / Uas Class Wali

The document contains Java code that defines classes for individuals, teachers, and students. The Individual class stores name, address, and age attributes. The Teacher and Student classes extend the Individual class and add additional attributes for an ID number. The code includes getter and setter methods to access the attributes. A Main class instantiates objects of each class and calls their info methods to output the attribute values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama : Rafif Mallow Dwi Syamsoe

NPM : 15183207081
Prodi : PTI – 5B

TUGAS AKHIR / UAS


Class Wali
package DataGuruMurid;

/**
*
* @author Apip
*/
public class Individu {

private String Nama;


private String Alamat;
private int Umur;

public Individu(){

public Individu(String Nama, String Alamat, int Umur){


this.Nama = Nama;
this.Alamat = Alamat;
this.Umur = Umur;
}

public String getNama(){


return Nama;
}

public String getAlamat(){


return Alamat;
}

public int getUmur(){


return Umur;
}

public void setNama(String Nama){


this.Nama = Nama;
}

public void setAlamat(String Alamat){


this.Alamat = Alamat;
}

public void setUmur(int Umur){


this.Umur = Umur;
}

public void infoIndividu() {


System.out.println("\nInfo Wali Murid");
System.out.println("Nama\t\t: " + getNama());
System.out.println("Alamat\t\t: " + getAlamat());
System.out.println("Umur\t\t: " + getUmur());
}
}

Class Guru
package DataGuruMurid;

public class Guru extends Individu{

private String idGuru;

public Guru(){
}
public Guru(String Nama, String Alamat, int Umur, String idGuru){
super(Nama, Alamat, Umur);
this.idGuru = idGuru;
}

public String getIdGuru(){


return idGuru;
}

public void setIdGuru(String idGuru){


this.idGuru = idGuru;
}

public void infoGuru(){


System.out.println("\nInfo Guru");
System.out.println("idGuru\t\t: " + getIdGuru());
System.out.println("Nama\t\t: " + getNama());
System.out.println("Alamat\t\t: " + getAlamat());
System.out.println("Umur\t\t: " + getUmur());
}
}

Class Murid
package DataGuruMurid;

public class Murid extends Individu{

private String NISN;

public Murid (){


}
public Murid(String Nama, String Alamat, int Umur, String NISN){
super(Nama, Alamat, Umur);
this.NISN = NISN;
}

public String getNISN(){


return NISN;
}

public void setNISN(String NISN){


this.NISN = NISN;
}

public void infoMurid(){


System.out.println("\nInfo Murid");
System.out.println("NISN\t\t: " + getNISN());
System.out.println("Nama\t\t: " + getNama());
System.out.println("Alamat\t\t: " + getAlamat());
System.out.println("Umur\t\t: " + getUmur());
}
}

Main Class
package DataGuruMurid;

public class Main {


public static void main(String[]asdasd){
Individu a = new Individu("Kodrat","Medan",51);
a.infoIndividu();

Guru b = new Guru("Ismail","Makassar",45,"10.05.09");


b.infoGuru();

Murid c = new Murid("Marcow","Lombok",17,"18.03.666");


c.infoMurid();
System.out.println("-----------------------------------");
}
}

Hasil

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy