Gaguh Suma Wantoko / 2012420019
public class algoritma1 {
public class algoritma1 {
public String
nama;
public String nim;
public String
fakultas;
public double
tugas;
public double uts;
public double uas;
public float
rata2;
//method asesor
dan mutator//
public void
print(){
}
public String
getNama(){
return nama;
}
public void
setNama(String temp){
nama = temp;
}
public String
getNIM(){
return nim;
}
public void
setNIM(String temp){
nim = temp;
}
public String
getFak(){
return
fakultas;
}
public void
setFak(String temp){
fakultas =
temp;
}
public double
getTgs(){
return tugas;
}
public void
setTgs(double temp){
tugas = temp;
}
public double
getUts(){
return uts;
}
public void
setUts(double temp){
uts =temp;
}
public double
getUas(){
return uas;
}
public void
setUas(double temp){
uas = temp ;
}
public float
getRata2(){
float result=0;
result=(float)
((tugas+uts+uas)/3);
return result;
}
//overloading//
public void
print(String temp){
System.out.println("nama="+nama);
System.out.println("nim="+"\t"+nim);
System.out.println("fakultas="+fakultas);
}
public void
print(double tugas,double uts,double
uas){
System.out.println("tugas="+"\t"+tugas);
System.out.println("uts="+"\t"+uts);
System.out.println("uas="+"\t"+uas);
}
public void print
(float rata2){
System.out.println("rata2 :"+rata2);
}
public static
void main(String[] args) {
algoritma1 x
= new algoritma1();
x.setNama("gaguh sukma");
x.setNIM("2012420019");
x.setFak("teknik informatika");
x.setTgs(90);
x.setUts(75);
x.setUas(80);
x.getRata2();
x.print(x.getNama());
x.print(x.getTgs(),x.getUts(),x.getUas());
x.print((x.getRata2()));
}
}
output:
Posted by 05.10 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar