Skip to content

Instantly share code, notes, and snippets.

@inertperson
Created October 1, 2012 17:45
Show Gist options
  • Save inertperson/3813274 to your computer and use it in GitHub Desktop.
Save inertperson/3813274 to your computer and use it in GitHub Desktop.
Java: contoh inheritance
public class Nilai extends Grade{
double presensi ;
double uts;
double uas;
double tugas;
public Nilai(){
this.presensi = 0;
this.uts = 0;
this.uas = 0;
this.tugas = 0;
super.nilaiAkhir = 0;
}
public void setPresensi(double presensi){
this.presensi=presensi;
}
public void setUts (double uts){
this.uts=uts;
}
public void setUas (double uas){
this.uas=uas;
}
public void setTugas (double tugas){
this.tugas=tugas;
}
public void setNilaiAkhir(){
double n = 0.0;
n = this.presensi + this.uts + this.uas + this.tugas;
this.nilaiAkhir = n;
}
public get
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment