hvienjava
package HocVien;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2011</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.io.*;
public class HocVien {
private String mahv;
private String hoten;
private int namsinh;
private float d1,d2,dck;
public HocVien() {
}
public HocVien(String mhv,String ht,int ns,float d1,float d2,float dck) {
this.mahv=mhv;
this.hoten=ht;
this.namsinh=ns;
this.d1=d1;
this.d2=d2;
this.dck=dck;
}
public void nhap()throws IOException{
BufferedReader kbd=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Nhap ma hoc vien :");
mahv=kbd.readLine();
System.out.println("Nhap ma ho ten :");
hoten=kbd.readLine();
System.out.println("Nhap nam sinh :");
namsinh=Integer.parseInt(kbd.readLine());
System.out.println("Nhap diem 1 :");
d1=Float.parseFloat(kbd.readLine());
System.out.println("Nhap diem 2 :");
d2=Float.parseFloat(kbd.readLine());
System.out.println("Nhap diem thi cuoi khoa :");
dck=Float.parseFloat(kbd.readLine());
}
public float dtb(){
float x=(((d1+d2)/2)+dck*2)/3;
return x;
}
public String xeploai(){
float a=dtb();
String s;
if(a>=8) s="Gioi";
else if(a>=7);
else if(a>=5);
else;
return s;
}
String getMa(){
return this.mahv;
}
String getHoten(){
return this.hoten;
}
int getNS(){
return this.namsinh;
}
float getD1(){
return this.d1;
}
float getD2(){
return this.d2;
}
float getDck(){
return this.dck;
}
public void get(){
System.out.println("Thong tin hoc vien:");
System.out.println("Ma hoc vien:"+mahv);
System.out.println("Ten hoc vien:"+hoten);
System.out.println("Nam sinh:"+namsinh);
System.out.println("diem 1:"+d1);
System.out.println("diem 2:"+d2);
System.out.println("diem thi cuoi khoa:"+dck);
System.out.println("diem trung binh:"+dtb());
}
}
Bạn đang đọc truyện trên: Truyen247.Pro