/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package manusia_oop;
class manusia{
public String nama;
public int npm;
public double ipk;
public int nomor_id;
public int gaji;
public manusia (){};
public manusia (String Nama){
nama = Nama;
System.out.println("Nama = " + nama);
}
public void Manusia(){
System.out.println("Methot ini milik class induk 'Manusia'");
System.out.println("======================================");
}
public void Mahasiswa (int Npm, double Ipk){
npm = Npm;
ipk = Ipk;
System.out.println("Npm = " + npm );
System.out.println("Nilai Ipk = " + ipk);
}
public String get_Nama(){
return nama;
}
}
class mahasiswa extends manusia {
public void view_mahasiswa(int Npm, double Ipk){
Mahasiswa (1135010009,3.5);
}
public void Mahasiswa(){
System.out.println("Methot ini milik class 'Mahasiswa'");
System.out.println("==================================");
}
}
class pekerja extends manusia{
public void view_pekerja (int Nomor_id, int Gaji){
Manusia ();
}
pekerja (int Nomor_id, int Gaji){
nomor_id = Nomor_id;
gaji = Gaji;
System.out.println("Nomor id pegawai = " + nomor_id);
System.out.println("Gaji yang diperoleh = Rp." + gaji + " Juta ");
}
public void Pekerja(){
System.out.println("Methot ini milik class 'pekerja'");
System.out.println("================================");
}
}
/**
*
* @author agus
*/
public class Manusia_OOP {
public static void main(String[] args) {
manusia x = new manusia("Agus gunawan");
x.Manusia();
mahasiswa si = new mahasiswa();
si.view_mahasiswa(1135010009,3.5);
si.Mahasiswa();
pekerja upn = new pekerja(1234,1);
upn.Pekerja();
}
}
0 komentar:
Posting Komentar