Gaguh Sukma Wantoko/2012420019
public class algoritmaconstructor {
public String
nama;
public String nim;
public String
fakultas;
public double
tugas;
public double uts;
public double uas;
public double
rata2;
public
algoritmaconstructor(String Nama,String Nim,String Fakultas){
this.nama=Nama;
this.nim=Nim;
this.fakultas=Fakultas;
}
public
algoritmaconstructor(double Tgs,double Uts,double Uas){
this.tugas=Tgs;
this.uts=Uts;
this.uas=Uas;
}
public
algoritmaconstructor(){
}
public void
print(){
System.out.println("Nama :"+getNama());
System.out.println("Nim :"+getNIM());
System.out.println("Fakultas :"+getFak());
}
public void
print(double Tgs,double Uts,double Uas){
//
System.out.println("Nilai Tugas ="+"\t"+getTgs());
System.out.println("Nilai Uts ="+"\t"+getUts());
System.out.println("Nilai Uas ="+"\t" +getUas());
//
}
public void print
(float Rata2){
float
result=0;
result=(float)
((tugas+uts+uas)/3);
System.out.println("Rata2 ="+Rata2);
}
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;
}
public static void
main(String[] args) {
algoritmaconstructor x =new algoritmaconstructor("Gaguh Sukma
Wanto",
"2012420019",
"Teknik Informatika");
algoritmaconstructor y =new algoritmaconstructor(80,70,80);
algoritmaconstructor z =new algoritmaconstructor();
x.print();
y.print(y.getTgs(),y.getUts(),y.getUas());
z.print(y.getRata2());
}
}
output
Posted by 10.11 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar