Bai Tap sinh vien

import java.util.Scanner; public class SinhVien { private String mssv; private String hoTen; private float diemTB; private int diemRenLuyen; private String xepLoai; private float hocBong; public SinhVien() { this.diemTB = 0; this.hocBong = 0; } public SinhVien(String mssv, String hoTen) { this.mssv = mssv; this.hoTen = hoTen; } public SinhVien(String mssv, String hoTen, float diemTB, int diemRenLuyen) { this.diemRenLuyen = diemRenLuyen; this.diemTB = diemTB; this.hoTen = hoTen; this.mssv = mssv; } public SinhVien(SinhVien SV) { } public String getMssv() { return mssv; } public void setMssv(String mssv) { this.mssv = mssv; } public String getHoTen() { return hoTen; } public void setHoTen(String hoTen) { this.hoTen = hoTen; } public float getDiemTB() { return diemTB; } public void setDiemTB(float diemTB) { this.diemTB = diemTB; } public int getDiemRenLuyen() { return diemRenLuyen; } public void setDiemRenLuyen(int diemRenLuyen) { this.diemRenLuyen = diemRenLuyen; } public void nhapThongTin() { Scanner input = new Scanner(System.in); System.out.print("Nhap vao Ma So Sinh Vien: "); mssv = input.nextLine(); System.out.printf("\nNhap vao Ho va Ten cua sinh vien: "); hoTen = input.nextLine(); System.out.printf("\nNhap vao diem trung binh cua sinh vien: "); diemTB = input.nextFloat(); System.out.printf("\nNhap diem ren luyen cua sinh vien: "); diemRenLuyen = input.nextInt(); } public void ketQua() { if (diemTB >= 5 && diemRenLuyen >= 50) { xepLoai = "Dat"; } else { xepLoai = "Khong Dat"; } } public void hocBong() { if (diemTB >= 8 && diemRenLuyen >= 70) { hocBong = 8000000; } else if (diemTB < 8 && diemTB >= 7 && diemRenLuyen >= 60) { hocBong = 6000000; } else { hocBong = 0; } } public void xuatThongTinSV() { System.out.println("Ma so sinh vien : " + mssv); System.out.println("Ho va Ten sinh vien: " + hoTen); System.out.println("Diem trung binh: " + diemTB); System.out.println("Diem ren luyen: " + diemRenLuyen); System.out.println("Xep loai: " + xepLoai); System.out.println("Hoc bong: " + hocBong); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.