-
07-19-2014, 07:00 AM #41Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
Gửi bởi htmljava
Mã nguồn PHP:[color=#000000]
[/color][color=#007700]public [/color][color=#0000bb]void inputsv[/color][color=#007700]() {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập thông tin sinh viên!"[/color][color=#007700]);[/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập tên sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập lớp học: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lophoc [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm toán: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm lý: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm hóa: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); }public [/color][color=#0000bb]void inputgv[/color][color=#007700]() {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập thông tin giảng viên!"[/color][color=#007700]);[/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập tên giảng viên: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập lớp dạy: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập năm sinh: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } [/color]
-
09-07-2014, 07:00 AM #42Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai tap ve nha (move your mouse to reveal the content)</noscript>
bai tap ve nha (open)
bai tap ve nha (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package baitapvenha[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/** * bài 1: tạo package nhân sự, trong có 2 class là sinh viên và giảng viên class * sinh viên gồm các thuộc tính: họ tên, lớp học, điểm toán, lý, hóa. class * giảng viên gồm các thuộc tính: họ tên, lớp dạy, năm sinh, lương. tạo đối * tượng học sinh a. tạo đối tượng giảng viên b. các giá trị của thuộc tính a và * b nhập vào từ bàn phím. xử lý dữ liệu báo ra thông tin của a và b, tính và * báo ra điểm trung bình của a, xếp loại học lực, báo b có dạy a hay không! các * thuộc tính để private, sử dụng phương thức getter, setter. lập trình hướng * đối tượng! */[/color][color=#007700]public class [/color][color=#0000bb]bai15_nhansu [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]bai15_nhansu test [/color][color=#007700]= new [/color][color=#0000bb]bai15_nhansu[/color][color=#007700](); [/color][color=#0000bb]sinhvien sv [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]giangvien gv [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/color][color=#007700](); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapsinhvien[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]nhapgiangvien[/color][color=#007700]([/color][color=#0000bb]gv[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]xuatsinhvien[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]xuatgiangvien[/color][color=#007700]([/color][color=#0000bb]gv[/color][color=#007700]); [/color][color=#0000bb]test[/color][color=#007700].[/color][color=#0000bb]checklop[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700], [/color][color=#0000bb]gv[/color][color=#007700]); } public [/color][color=#0000bb]void nhapsinhvien[/color][color=#007700]([/color][color=#0000bb]sinhvien sv[/color][color=#007700]) { [/color][color=#0000bb]scanner sc [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thong tin sinh vien: "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" ho ten : "[/color][color=#007700]); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" lop hoc: "[/color][color=#007700]); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]setlophoc[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" toan : "[/color][color=#007700]); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]setdtoan[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" ly : "[/color][color=#007700]); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]setdly[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" hoa : "[/color][color=#007700]); [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]setdhoa[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); } public [/color][color=#0000bb]void xuatsinhvien[/color][color=#007700]([/color][color=#0000bb]sinhvien sv[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
sinh vien vua nhap:"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoten\tlophoc\ttoan\tly\thoa"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]getdtoan[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]getdly[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]getdhoa[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]xeploai[/color][color=#007700]()); } public [/color][color=#0000bb]void xuatgiangvien[/color][color=#007700]([/color][color=#0000bb]giangvien gv[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
giang vien vua nhap:"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoten\tlopday\tnamsinh\tluong"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getnamsinh[/color][color=#007700]()+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getmucluong[/color][color=#007700]()); } public [/color][color=#0000bb]void nhapgiangvien[/color][color=#007700]([/color][color=#0000bb]giangvien gv[/color][color=#007700]) { [/color][color=#0000bb]scanner sc [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thong tin giang vien: "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" ho ten : "[/color][color=#007700]); [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" lop day : "[/color][color=#007700]); [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setlopday[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" nam sinh: "[/color][color=#007700]); [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]" luong : "[/color][color=#007700]); [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setmucluong[/color][color=#007700]([/color][color=#0000bb]sc[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); } public [/color][color=#0000bb]void checklop[/color][color=#007700]([/color][color=#0000bb]sinhvien sv[/color][color=#007700], [/color][color=#0000bb]giangvien gv[/color][color=#007700]) { if ([/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]().[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]()) == [/color][color=#0000bb]true[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giang vien " [/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()+ [/color][color=#dd0000]" day sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" cua lop "[/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]()); } }} class [/color][color=#0000bb]sinhvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700], [/color][color=#0000bb]lophoc[/color][color=#007700]; private [/color][color=#0000bb]float dtoan[/color][color=#007700], [/color][color=#0000bb]dly[/color][color=#007700], [/color][color=#0000bb]dhoa[/color][color=#007700]; public [/color][color=#0000bb]float diemtb[/color][color=#007700]() { return ([/color][color=#0000bb]dtoan [/color][color=#007700]+ [/color][color=#0000bb]dly [/color][color=#007700]+ [/color][color=#0000bb]dhoa[/color][color=#007700]) / [/color][color=#0000bb]3[/color][color=#007700]; } public [/color][color=#0000bb]string xeploai[/color][color=#007700]() { [/color][color=#0000bb]float dtb [/color][color=#007700]= [/color][color=#0000bb]diemtb[/color][color=#007700](); [/color][color=#0000bb]string s [/color][color=#007700]= [/color][color=#dd0000]"diem trung binh = " [/color][color=#007700]+ [/color][color=#0000bb]dtb [/color][color=#007700]+ [/color][color=#dd0000]" xep loai \""[/color][color=#007700]; if ([/color][color=#0000bb]dtb [/color][color=#007700]>= [/color][color=#0000bb]8.5[/color][color=#007700]) { [/color][color=#0000bb]s [/color][color=#007700]+= [/color][color=#dd0000]"gioi\""[/color][color=#007700]; } else if ([/color][color=#0000bb]dtb [/color][color=#007700]>= [/color][color=#0000bb]7 [/color][color=#007700]&& [/color][color=#0000bb]dtb [/color][color=#007700]< [/color][color=#0000bb]8.5[/color][color=#007700]) { [/color][color=#0000bb]s [/color][color=#007700]+= [/color][color=#dd0000]"kha\""[/color][color=#007700]; } else if ([/color][color=#0000bb]dtb [/color][color=#007700]>= [/color][color=#0000bb]5.5 [/color][color=#007700]&& [/color][color=#0000bb]dtb [/color][color=#007700]< [/color][color=#0000bb]7[/color][color=#007700]) { [/color][color=#0000bb]s [/color][color=#007700]+= [/color][color=#dd0000]"trung binh\""[/color][color=#007700]; } else [/color][color=#0000bb]s [/color][color=#007700]+= [/color][color=#dd0000]"yeu\""[/color][color=#007700]; return [/color][color=#0000bb]s[/color][color=#007700]; } public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlophoc[/color][color=#007700]() { return [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]void setlophoc[/color][color=#007700]([/color][color=#0000bb]string lophoc[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lophoc [/color][color=#007700]= [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]float getdtoan[/color][color=#007700]() { return [/color][color=#0000bb]dtoan[/color][color=#007700]; } public [/color][color=#0000bb]void setdtoan[/color][color=#007700]([/color][color=#0000bb]float dtoan[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]dtoan [/color][color=#007700]= [/color][color=#0000bb]dtoan[/color][color=#007700]; } public [/color][color=#0000bb]float getdly[/color][color=#007700]() { return [/color][color=#0000bb]dly[/color][color=#007700]; } public [/color][color=#0000bb]void setdly[/color][color=#007700]([/color][color=#0000bb]float dly[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]dly [/color][color=#007700]= [/color][color=#0000bb]dly[/color][color=#007700]; } public [/color][color=#0000bb]float getdhoa[/color][color=#007700]() { return [/color][color=#0000bb]dhoa[/color][color=#007700]; } public [/color][color=#0000bb]void setdhoa[/color][color=#007700]([/color][color=#0000bb]float dhoa[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]dhoa [/color][color=#007700]= [/color][color=#0000bb]dhoa[/color][color=#007700]; }} class [/color][color=#0000bb]giangvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700], [/color][color=#0000bb]lopday[/color][color=#007700]; private [/color][color=#0000bb]int namsinh[/color][color=#007700], [/color][color=#0000bb]mucluong[/color][color=#007700]; public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlopday[/color][color=#007700]() { return [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]void setlopday[/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() { return [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]int getmucluong[/color][color=#007700]() { return [/color][color=#0000bb]mucluong[/color][color=#007700]; } public [/color][color=#0000bb]void setmucluong[/color][color=#007700]([/color][color=#0000bb]int mucluong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mucluong [/color][color=#007700]= [/color][color=#0000bb]mucluong[/color][color=#007700]; } }[/color]
</div>
</div>
-
09-15-2014, 07:00 AM #43Junior Member
- Ngày tham gia
- Oct 2014
- Bài viết
- 0
[color=rgb(0, 0, 255)]package nhan.su;
import java.util.scanner;
class [/color]sinhvien [color=rgb(0, 128, 0)]{[/color]
[color=rgb(0, 0, 255)] private[/color] string hoten[color=rgb(0, 128, 0)];[/color]
[color=rgb(0, 0, 255)] private[/color] string lophoc[color=rgb(0, 128, 0)];[/color]
[color=rgb(0, 0, 255)] private[/color] float diemtoan[color=rgb(0, 128, 0)];[/color]
[color=rgb(0, 0, 255)] private[/color] float diemly;
private float diemhoa[color=rgb(0, 128, 0)];[/color]
[color=rgb(0, 0, 255)] public[/color] [color=rgb(0, 128, 0)]void[/color] sethoten[color=rgb(0, 128, 0)]([/color]string hoten[color=rgb(0, 128, 0)])[/color] [color=rgb(0, 128, 0)]{[/color]
[color=rgb(0, 0, 255)] this.[/color]hoten [color=rgb(0, 128, 0)]=[/color] hoten[color=rgb(0, 128, 0)];[/color]
[color=rgb(0, 0, 255)] }[/color]
[color=rgb(0, 0, 255)] public void setlophoc[/color] ([color=rgb(0, 0, 255)]string lophoc[/color]) {
[color=rgb(0, 128, 0)] this[/color].[color=rgb(0, 0, 255)]lophoc[/color] = [color=rgb(0, 0, 255)]lophoc[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public void setdiemtoan[/color]([color=rgb(0, 0, 255)]float diemtoan[/color]) {
[color=rgb(0, 128, 0)] this[/color].[color=rgb(0, 0, 255)]diemtoan[/color] = [color=rgb(0, 0, 255)]diemtoan[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public void setdiemly[/color]([color=rgb(0, 0, 255)]float diemly[/color]) {
[color=rgb(0, 128, 0)] this[/color].[color=rgb(0, 0, 255)]diemly[/color] = [color=rgb(0, 0, 255)]diemly[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public void setdiemhoa[/color]([color=rgb(0, 0, 255)]float[/color] [color=rgb(0, 0, 255)]diemhoa[/color]) {
[color=rgb(0, 128, 0)] this[/color].[color=rgb(0, 0, 255)]diemhoa[/color] = [color=rgb(0, 0, 255)]diemhoa[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public string[/color] [color=rgb(0, 0, 255)]gethoten[/color]() {
[color=rgb(0, 128, 0)] return[/color] [color=rgb(0, 0, 255)]hoten[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public string getlophoc[/color]() {
[color=rgb(0, 0, 255)] return[/color] [color=rgb(0, 0, 255)]lophoc[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public float[/color] [color=rgb(0, 0, 255)]getdiemtoan[/color]() {
[color=rgb(0, 128, 0)] return [/color]diemtoan;
[color=rgb(0, 0, 255)] }[/color]
[color=rgb(0, 0, 255)] public float[/color] [color=rgb(0, 0, 255)]getdiemly[/color]() {
[color=rgb(0, 128, 0)] return[/color] [color=rgb(0, 0, 255)]diemly[/color];
[color=rgb(0, 128, 0)] }[/color]
[color=rgb(0, 0, 255)] public float getdiemhoa[/color]() {
[color=rgb(0, 0, 255)] return[/color] diemhoa;
[color=rgb(0, 0, 255)] }[/color]
[color=rgb(0, 0, 255)]//để khi khác làm tiếp nhé![/color]
-
01-08-2015, 07:00 AM #44Junior Member
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
em nộp bài :d
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>bai 15 (move your mouse to reveal the content)</noscript>
bai 15 (open)
bai 15 (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package lesson15[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; class [/color][color=#0000bb]sinhvien [/color][color=#007700]{ [/color][color=#0000bb]scanner scan01 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); private [/color][color=#0000bb]string hoten[/color][color=#007700],[/color][color=#0000bb]lophoc[/color][color=#007700]; private [/color][color=#0000bb]float toan[/color][color=#007700],[/color][color=#0000bb]ly[/color][color=#007700],[/color][color=#0000bb]hoa[/color][color=#007700]; public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void setlophoc[/color][color=#007700]([/color][color=#0000bb]string lophoc[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lophoc [/color][color=#007700]= [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]void settoan[/color][color=#007700]([/color][color=#0000bb]int toan[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]void setly[/color][color=#007700]([/color][color=#0000bb]int ly[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]void sethoa[/color][color=#007700]([/color][color=#0000bb]int hoa[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]hoa[/color][color=#007700]; } public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlophoc[/color][color=#007700]() { return [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]float gettoan[/color][color=#007700]() { return [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]float getly[/color][color=#007700]() { return [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]float gethoa[/color][color=#007700]() { return [/color][color=#0000bb]hoa[/color][color=#007700]; } public [/color][color=#0000bb]void enter[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ho ten : "[/color][color=#007700]);[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap lop : "[/color][color=#007700]); [/color][color=#0000bb]setlophoc[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem toan : "[/color][color=#007700]); [/color][color=#0000bb]settoan[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem li : "[/color][color=#007700]); [/color][color=#0000bb]setly[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem hoa: "[/color][color=#007700]); [/color][color=#0000bb]sethoa[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); if ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan[/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly[/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan[/color][color=#007700]>[/color][color=#0000bb]10 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly[/color][color=#007700]>[/color][color=#0000bb]10 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa[/color][color=#007700]>[/color][color=#0000bb]10[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"gia tri khong hop le.yeu cau nhap lai."[/color][color=#007700]); } }while ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan[/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly[/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan[/color][color=#007700]>[/color][color=#0000bb]10 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly[/color][color=#007700]>[/color][color=#0000bb]10 [/color][color=#007700]|| [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa[/color][color=#007700]>[/color][color=#0000bb]10[/color][color=#007700]); } public [/color][color=#0000bb]void ainf[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thong tin sinh vien ."[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ho ten : " [/color][color=#007700]+ [/color][color=#0000bb]gethoten[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lop : " [/color][color=#007700]+ [/color][color=#0000bb]getlophoc[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"diem toan : " [/color][color=#007700]+ [/color][color=#0000bb]gettoan[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"diem ly : "[/color][color=#007700]+ [/color][color=#0000bb]getly[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"diem hoa : " [/color][color=#007700]+ [/color][color=#0000bb]gethoa[/color][color=#007700]()); [/color][color=#0000bb]float dtb[/color][color=#007700]=([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"diem trung binh la :" [/color][color=#007700]+ [/color][color=#0000bb]dtb[/color][color=#007700]); if ([/color][color=#0000bb]dtb [/color][color=#007700]<=[/color][color=#0000bb]10 [/color][color=#007700]&& [/color][color=#0000bb]dtb [/color][color=#007700]>=[/color][color=#0000bb]8.5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep loai gioi"[/color][color=#007700]); }else{ if([/color][color=#0000bb]dtb [/color][color=#007700]<[/color][color=#0000bb]8.5 [/color][color=#007700]&& [/color][color=#0000bb]dtb [/color][color=#007700]>= [/color][color=#0000bb]6.5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep loai kha"[/color][color=#007700]); }else{ if ([/color][color=#0000bb]dtb[/color][color=#007700]<[/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]dtb[/color][color=#007700]<= [/color][color=#0000bb]5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep loai trung binh"[/color][color=#007700]); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep loai yeu"[/color][color=#007700]); } } } }}class [/color][color=#0000bb]giangvien [/color][color=#007700]{ [/color][color=#0000bb]scanner scan01 [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); private [/color][color=#0000bb]int namsinh[/color][color=#007700]; private [/color][color=#0000bb]long luong[/color][color=#007700]; private [/color][color=#0000bb]string lopday[/color][color=#007700],[/color][color=#0000bb]ten[/color][color=#007700]; public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() { return [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]long getluong[/color][color=#007700]() { return [/color][color=#0000bb]luong[/color][color=#007700]; } public [/color][color=#0000bb]string getlopday[/color][color=#007700]() { return [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]string getten[/color][color=#007700]() { return [/color][color=#0000bb]ten[/color][color=#007700]; } public [/color][color=#0000bb]void setluong[/color][color=#007700]([/color][color=#0000bb]long luong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]luong[/color][color=#007700]; } public [/color][color=#0000bb]void setlopday[/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]void setten[/color][color=#007700]([/color][color=#0000bb]string ten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]ten[/color][color=#007700]; } public [/color][color=#0000bb]void enter[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ho ten giang vien : "[/color][color=#007700]); [/color][color=#0000bb]setten[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap lop day : "[/color][color=#007700]); [/color][color=#0000bb]setlopday[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap luong : "[/color][color=#007700]); [/color][color=#0000bb]setluong[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextlong[/color][color=#007700]()); if ([/color][color=#0000bb]getluong[/color][color=#007700]() < [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]getnamsinh[/color][color=#007700]()<[/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap nam sinh : "[/color][color=#007700]); [/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]scan01[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"luong khong duoc nho hon 0. moi nhap lai."[/color][color=#007700]); } }while ([/color][color=#0000bb]getluong[/color][color=#007700]()<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]getnamsinh[/color][color=#007700]()<[/color][color=#0000bb]0[/color][color=#007700]); } public [/color][color=#0000bb]void binf[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thong tin giang vien ."[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ho ten : "[/color][color=#007700]+ [/color][color=#0000bb]getten[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nam sinh : " [/color][color=#007700]+ [/color][color=#0000bb]getnamsinh[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"luong : "[/color][color=#007700]+[/color][color=#0000bb]getluong[/color][color=#007700]()); } }public class [/color][color=#0000bb]lesson15 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#ff8000]//main [/color][color=#0000bb]sinhvien a [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]giangvien b [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thong tin sinh vien."[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]enter[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thong tin giang vien."[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]enter[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]ainf[/color][color=#007700](); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]binf[/color][color=#007700](); if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]().[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]())) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giang vien " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getten[/color][color=#007700]()+[/color][color=#dd0000]" day sinh vien" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]()); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giang vien " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getten[/color][color=#007700]()+[/color][color=#dd0000]" khong day sinh vien" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]()); } } }[/color]
</div>
</div>
-
01-18-2015, 07:00 AM #45Junior Member
- Ngày tham gia
- May 2015
- Bài viết
- 0
em nộp bài, có gì mong anh chị chỉ giáo ạ :d
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class sinhvien (move your mouse to reveal the content)</noscript>
class sinhvien (open)
class sinhvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:package oop.nhan.su; import java.util.scanner; /** * * @author xtruong */ public class sinhvien { private string hoten; private string lop; private float diemtoan; private float diemly; private float diemhoa; public string gethoten() { return hoten; } public void sethoten(string hoten) { this.hoten = hoten; } public string getlop() { return lop; } public void setlop(string lop) { this.lop = lop; } public float getdiemtoan() { return diemtoan; } public void setdiemtoan(float diemtoan) { this.diemtoan = diemtoan; } public float getdiemly() { return diemly; } public void setdiemly(float diemly) { this.diemly = diemly; } public float getdiemhoa() { return diemhoa; } public void setdiemhoa(float diemhoa) { this.diemhoa = diemhoa; } public void nhap() { scanner input = new scanner(system.in); system.out.println("nhap thong tin sinh vien"); system.out.println("nhap ho ten sinh vien: "); sethoten(input.nextline()); system.out.println("nhap lop sinh vien dang hoc: "); setlop(input.nextline()); do { system.out.println("nhap diem toan: "); diemtoan = input.nextfloat(); } while( diemtoan < 0f || diemtoan > 10f); do { system.out.println("nhap diem ly: "); diemly = input.nextfloat(); } while( diemly < 0f || diemly > 10f); do { system.out.println("nhap diem hoa: "); diemhoa = input.nextfloat(); } while( diemhoa < 0f || diemhoa > 10f); } public string hocluc(float diemtb) { if(diemtb > 8) { return "gioi"; } else if(diemtb > 7) { return "kha"; } else if(diemtb >5) { return "trung binh"; } else { return "kem"; } } public void show() { system.out.println("\t\t thong tin sinh vien"); system.out.println("------------------------------------------"); // goi cac bien co the su dung this hoac goi truc tiep ten cung dc // nhung chuan nhat thi ta su dung ham get de lay du lieu ra system.out.println("ten sinh vien: " + gethoten()); system.out.println("lop sinh vien dang hoc: " + getlop()); system.out.println("diem toan: " + getdiemtoan()); system.out.println("diem ly: " + getdiemly()); system.out.println("diem hoa: " + getdiemhoa()); float diemtb = (float)((getdiemtoan() + getdiemly() + getdiemhoa())/3); system.out.println("diem tb 3 mon: " + diemtb); system.out.println("hoc luc: " + hocluc(diemtb)); } }
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class giangvien (move your mouse to reveal the content)</noscript>
class giangvien (open)
class giangvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:package oop.nhan.su; import java.util.scanner; /** * * @author xtruong */ public class giangvien { private string hoten; private string lopday; private int namsinh; private double luong; public string gethoten() { return hoten; } public void sethoten(string hoten) { this.hoten = hoten; } public string getlopday() { return lopday; } public void setlopday(string lopday) { this.lopday = lopday; } public int getnamsinh() { return namsinh; } public void setnamsinh(int namsinh) { this.namsinh = namsinh; } public double getluong() { return luong; } public void setluong(double luong) { this.luong = luong; } public void nhap() { scanner input = new scanner(system.in); system.out.println("nhap thong tin giang vien"); system.out.println("nhap ten: "); sethoten(input.nextline()); system.out.println("nhap lop dang day: "); setlopday(input.nextline()); system.out.println("nhap nam sinh: "); setnamsinh(input.nextint()); system.out.println("nhap luong: "); setluong(input.nextdouble()); } public void show(){ system.out.println("\t\t thong tin giang vien"); system.out.println("-----------------------------------------"); system.out.println("ten giang vien: " + gethoten()); system.out.println("lop giang vien dang day: " + getlopday()); system.out.println("nam sinh cua giang vien: " + getnamsinh()); system.out.println("luong giang vien: " + getluong()); } }
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class main (move your mouse to reveal the content)</noscript>
class main (open)
class main (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:package oop.nhan.su; /** * * @author xtruong */ public class main { public static void main(string[] args) { sinhvien a = new sinhvien(); giangvien b = new giangvien(); a.nhap(); a.show(); b.nhap(); b.show(); if((a.getlop()).equals(b.getlopday())) { system.out.println("giang vien b dang day sinh vien a"); } else { system.out.println("giang vien b khong day sinh vien a"); } } }
</div>
</div>
-
02-07-2015, 07:00 AM #46Junior Member
- Ngày tham gia
- Jan 2016
- Bài viết
- 9
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class sinhvien (move your mouse to reveal the content)</noscript>
class sinhvien (open)
class sinhvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
[/color][color=#ff8000]/** to change this template, choose tools | templates* and open the template in the editor.*/[/color][color=#0000bb]package unit15[/color][color=#007700]; [/color][color=#ff8000]/**** @author quanghuy*/[/color][color=#007700]public class [/color][color=#0000bb]sinhvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700]; private [/color][color=#0000bb]string lophoc[/color][color=#007700]; private [/color][color=#0000bb]double toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700]; public [/color][color=#0000bb]double trungbinh[/color][color=#007700]; public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void setlophoc[/color][color=#007700]([/color][color=#0000bb]string lophoc[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lophoc [/color][color=#007700]= [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]void settoan[/color][color=#007700]([/color][color=#0000bb]double toan[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]void setly[/color][color=#007700]([/color][color=#0000bb]double ly[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]void sethoa[/color][color=#007700]([/color][color=#0000bb]double hoa[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]hoa[/color][color=#007700]; } public [/color][color=#0000bb]string gethoten[/color][color=#007700](){ return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlophoc[/color][color=#007700](){ return [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]double gettoan[/color][color=#007700](){ return [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]double getly[/color][color=#007700](){ return [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]double gethoa[/color][color=#007700](){ return [/color][color=#0000bb]hoa[/color][color=#007700]; }}[/color]
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class giangvien (move your mouse to reveal the content)</noscript>
class giangvien (open)
class giangvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
[/color][color=#ff8000]/* * to change this template, choose tools | templates * and open the template in the editor. */[/color][color=#0000bb]package unit15[/color][color=#007700]; [/color][color=#ff8000]/** * * @author quanghuy */[/color][color=#007700]public class [/color][color=#0000bb]giangvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700]; private [/color][color=#0000bb]string lopday[/color][color=#007700]; private [/color][color=#0000bb]int namsinh[/color][color=#007700]; private [/color][color=#0000bb]int luong[/color][color=#007700]; public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void setlopday[/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]void setluong[/color][color=#007700]([/color][color=#0000bb]int luong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]luong[/color][color=#007700]; } public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlopday[/color][color=#007700]() { return [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() { return [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]int getluong[/color][color=#007700]() { return [/color][color=#0000bb]luong[/color][color=#007700]; } }[/color]
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>main (move your mouse to reveal the content)</noscript>
main (open)
main (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
[/color][color=#ff8000]/* * to change this template, choose tools | templates * and open the template in the editor. */[/color][color=#0000bb]package unit15[/color][color=#007700]; [/color][color=#ff8000]/** * * @author quanghuy */[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]unit15 [/color][color=#007700]{ [/color][color=#ff8000]/** * @param args the command line arguments */ [/color][color=#007700]public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#ff8000]// todo code application logic here [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]sinhvien a [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ho va ten sinh vien: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap lop hoc: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]setlophoc[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem toan: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]settoan[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem ly: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]setly[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem hoa: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]sethoa[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" hoc lop " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]() + [/color][color=#dd0000]" co diem toan: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700]() + [/color][color=#dd0000]" diem ly: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700]() + [/color][color=#dd0000]" diem hoa: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]()); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]= ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]() + [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700]() + [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700]()) / [/color][color=#0000bb]3[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"diem trung binh cua sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" la: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh[/color][color=#007700]); if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]< [/color][color=#0000bb]5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" co hoc luc yeu"[/color][color=#007700]); } else if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]>= [/color][color=#0000bb]5 [/color][color=#007700]&& [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]< [/color][color=#0000bb]6.5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" co hoc luc trung binh"[/color][color=#007700]); } else if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]>= [/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]trungbinh [/color][color=#007700]< [/color][color=#0000bb]8[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" co hoc luc kha"[/color][color=#007700]); } else { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" co hoc luc gioi"[/color][color=#007700]); } [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]giangvien b [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ho va ten giang vien: "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap lop day: "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]setlopday[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap nam sinh: "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap luong: "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]setluong[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]().[/color][color=#0000bb]compareto[/color][color=#007700]([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]()) == [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giang vien " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" dang giang day sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()); } else { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giang vien " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" khong giang day sinh vien " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()); } }}[/color]
</div>
</div>
-
04-29-2015, 07:00 AM #47Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
các bạn xem hộ mjh cái
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class sinhvien (move your mouse to reveal the content)</noscript>
class sinhvien (open)
class sinhvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package method[/color][color=#007700].[/color][color=#0000bb]setter[/color][color=#007700].[/color][color=#0000bb]getter[/color][color=#007700].[/color][color=#0000bb]nhan[/color][color=#007700].[/color][color=#0000bb]su[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; class [/color][color=#0000bb]sinhvien [/color][color=#007700]{private [/color][color=#0000bb]string hoten[/color][color=#007700], [/color][color=#0000bb]lop[/color][color=#007700];private [/color][color=#0000bb]float toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700]; public [/color][color=#0000bb]void input [/color][color=#007700]() {[/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập thông tin sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
họ tên: "[/color][color=#007700]);[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"lớp: "[/color][color=#007700]);[/color][color=#0000bb]lop [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"toán: "[/color][color=#007700]);[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"lý: "[/color][color=#007700]);[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"hóa: "[/color][color=#007700]);[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();} public [/color][color=#0000bb]string gethoten [/color][color=#007700]() {return [/color][color=#0000bb]hoten[/color][color=#007700];}public [/color][color=#0000bb]void sethoten [/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700];} public [/color][color=#0000bb]string getlop [/color][color=#007700]() {return [/color][color=#0000bb]lop[/color][color=#007700];}public [/color][color=#0000bb]void setlop [/color][color=#007700]([/color][color=#0000bb]string lop[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lop [/color][color=#007700]= [/color][color=#0000bb]lop[/color][color=#007700];} public [/color][color=#0000bb]float gettoan [/color][color=#007700]() {return [/color][color=#0000bb]toan[/color][color=#007700];}public [/color][color=#0000bb]void settoan [/color][color=#007700]([/color][color=#0000bb]float toan[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]toan[/color][color=#007700];} public [/color][color=#0000bb]float getly [/color][color=#007700]() {return [/color][color=#0000bb]ly[/color][color=#007700];}public [/color][color=#0000bb]void setly [/color][color=#007700]([/color][color=#0000bb]float ly[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]ly[/color][color=#007700];} public [/color][color=#0000bb]float gethoa [/color][color=#007700]() {return [/color][color=#0000bb]hoa[/color][color=#007700];}public [/color][color=#0000bb]void sethoa [/color][color=#007700]([/color][color=#0000bb]float hoa[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]hoa[/color][color=#007700];} public [/color][color=#0000bb]float diemtb [/color][color=#007700]([/color][color=#0000bb]float toan[/color][color=#007700], [/color][color=#0000bb]float ly[/color][color=#007700], [/color][color=#0000bb]float hoa[/color][color=#007700]) {return ([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700]) /[/color][color=#0000bb]3[/color][color=#007700];} public [/color][color=#0000bb]string xeploai [/color][color=#007700]([/color][color=#0000bb]float diemtb[/color][color=#007700]) {if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]10[/color][color=#007700]) {return [/color][color=#dd0000]"giỏi"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]8[/color][color=#007700]) {return [/color][color=#dd0000]"khá"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]>=[/color][color=#0000bb]5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<[/color][color=#0000bb]6.5[/color][color=#007700]) {return [/color][color=#dd0000]"trung bình"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]> [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<[/color][color=#0000bb]5[/color][color=#007700]) {return [/color][color=#dd0000]"yếu"[/color][color=#007700];}return [/color][color=#dd0000]"không hợp lệ"[/color][color=#007700];}}[/color]
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class giangvien (move your mouse to reveal the content)</noscript>
class giangvien (open)
class giangvien (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package method[/color][color=#007700].[/color][color=#0000bb]setter[/color][color=#007700].[/color][color=#0000bb]getter[/color][color=#007700].[/color][color=#0000bb]nhan[/color][color=#007700].[/color][color=#0000bb]su[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; class [/color][color=#0000bb]giangvien [/color][color=#007700]{private [/color][color=#0000bb]string hoten[/color][color=#007700], [/color][color=#0000bb]lopday[/color][color=#007700];private [/color][color=#0000bb]int namsinh[/color][color=#007700];private [/color][color=#0000bb]float luong[/color][color=#007700]; public [/color][color=#0000bb]void input [/color][color=#007700]() {[/color][color=#0000bb]scanner inp [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập thông tin giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
tên giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"lớp dạy: "[/color][color=#007700]);[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"năm sinh của giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"lương: "[/color][color=#007700]);[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();} public [/color][color=#0000bb]string gethoten [/color][color=#007700]() {return [/color][color=#0000bb]hoten[/color][color=#007700];}public [/color][color=#0000bb]void sethoten [/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700];} public [/color][color=#0000bb]string getlopday [/color][color=#007700]() {return [/color][color=#0000bb]lopday[/color][color=#007700];}public [/color][color=#0000bb]void setlopday [/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]lopday[/color][color=#007700];} public [/color][color=#0000bb]int getnamsinh [/color][color=#007700]() {return [/color][color=#0000bb]namsinh[/color][color=#007700];}public [/color][color=#0000bb]void setnamsinh [/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700];} public [/color][color=#0000bb]float getluong [/color][color=#007700]() {return [/color][color=#0000bb]luong[/color][color=#007700];}public [/color][color=#0000bb]void setluong [/color][color=#007700]([/color][color=#0000bb]float luong[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]luong[/color][color=#007700];} public [/color][color=#0000bb]string nhanxet[/color][color=#007700]([/color][color=#0000bb]float diemtb[/color][color=#007700]) {if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]10[/color][color=#007700]) {return [/color][color=#dd0000]"giáo viên dạy giỏi"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]8[/color][color=#007700]) {return [/color][color=#dd0000]"giáo viên dạy khá"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]>=[/color][color=#0000bb]5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<[/color][color=#0000bb]6.5[/color][color=#007700]) {return [/color][color=#dd0000]"giáo viên không để ý học sinh"[/color][color=#007700];}if ([/color][color=#0000bb]diemtb [/color][color=#007700]> [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<[/color][color=#0000bb]5[/color][color=#007700]) {return [/color][color=#dd0000]"giáo viên không dạy học sinh"[/color][color=#007700];}return [/color][color=#dd0000]"không hợp lệ"[/color][color=#007700];}}[/color]
</div>
</div>
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class main (move your mouse to reveal the content)</noscript>
class main (open)
class main (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package method[/color][color=#007700].[/color][color=#0000bb]setter[/color][color=#007700].[/color][color=#0000bb]getter[/color][color=#007700].[/color][color=#0000bb]nhan[/color][color=#007700].[/color][color=#0000bb]su[/color][color=#007700]; public class [/color][color=#0000bb]main [/color][color=#007700]{public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) {[/color][color=#0000bb]sinhvien a [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700]();[/color][color=#0000bb]giangvien b [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700]();[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"thông tin sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
họ tên:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" lớp:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlop[/color][color=#007700]() + [/color][color=#dd0000]" điểm toán:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700]() + [/color][color=#dd0000]" lý:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700]() + [/color][color=#dd0000]" hóa:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
thông tin giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
họ tên:" [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" lớp dạy:" [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]() + [/color][color=#dd0000]" năm sinh:" [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getnamsinh[/color][color=#007700]() + [/color][color=#dd0000]" lương:" [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getluong[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
điểm trung bình của a là:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]()) + [/color][color=#dd0000]" học lực:" [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]xeploai[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]())) );[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]nhanxet[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]()));[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
nhận sét giáo viên: " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]nhanxet[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gettoan[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getly[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]gethoa[/color][color=#007700]())));}}[/color]
</div>
</div>
-
09-03-2015, 07:00 AM #48Banned
- Ngày tham gia
- Jun 2014
- Bài viết
- 0
Mã nguồn PHP:package nhansu
Mã nguồn PHP:[color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]sinhvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700]; private [/color][color=#0000bb]string lophoc[/color][color=#007700]; private [/color][color=#0000bb]float toan[/color][color=#007700]; private [/color][color=#0000bb]float ly[/color][color=#007700]; private [/color][color=#0000bb]float hoa[/color][color=#007700]; private [/color][color=#0000bb]float diemtb[/color][color=#007700]; public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void setlophoc[/color][color=#007700]([/color][color=#0000bb]string lophoc[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lophoc [/color][color=#007700]= [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]void settoan[/color][color=#007700]([/color][color=#0000bb]float toan[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]void setly[/color][color=#007700]([/color][color=#0000bb]float ly[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]void sethoa[/color][color=#007700]([/color][color=#0000bb]float hoa[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]hoa[/color][color=#007700]; } public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlophoc[/color][color=#007700]() { return [/color][color=#0000bb]lophoc[/color][color=#007700]; } public [/color][color=#0000bb]float gettoan[/color][color=#007700]() { return [/color][color=#0000bb]toan[/color][color=#007700]; } public [/color][color=#0000bb]float getly[/color][color=#007700]() { return [/color][color=#0000bb]ly[/color][color=#007700]; } public [/color][color=#0000bb]float gethoa[/color][color=#007700]() { return [/color][color=#0000bb]hoa[/color][color=#007700]; } public [/color][color=#0000bb]void nhap[/color][color=#007700](){ [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập họ tên : "[/color][color=#007700]); [/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập lớp học : "[/color][color=#007700]); [/color][color=#0000bb]setlophoc[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm toán : "[/color][color=#007700]); [/color][color=#0000bb]settoan[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm lý : "[/color][color=#007700]); [/color][color=#0000bb]setly[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập điểm hóa : "[/color][color=#007700]); [/color][color=#0000bb]sethoa[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]()); [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } public [/color][color=#0000bb]float diemtb[/color][color=#007700]([/color][color=#0000bb]float toan[/color][color=#007700], [/color][color=#0000bb]float ly[/color][color=#007700], [/color][color=#0000bb]float hoa[/color][color=#007700]){ return ([/color][color=#0000bb]gettoan[/color][color=#007700]()+[/color][color=#0000bb]getly[/color][color=#007700]()+[/color][color=#0000bb]gethoa[/color][color=#007700]())/[/color][color=#0000bb]3[/color][color=#007700]; } public [/color][color=#0000bb]string xephang[/color][color=#007700]([/color][color=#0000bb]float diemtb[/color][color=#007700]){ if ([/color][color=#0000bb]diemtb [/color][color=#007700]<= [/color][color=#0000bb]10 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]9[/color][color=#007700]) { return [/color][color=#dd0000]" xuất sắc "[/color][color=#007700]; }else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]8 [/color][color=#007700]) { return [/color][color=#dd0000]" giỏi "[/color][color=#007700]; }else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700]) { return [/color][color=#dd0000]" khá"[/color][color=#007700]; }else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>=[/color][color=#0000bb]5[/color][color=#007700]) { return [/color][color=#dd0000]" trung bình "[/color][color=#007700]; }else if ([/color][color=#0000bb]diemtb[/color][color=#007700]>=[/color][color=#0000bb]0[/color][color=#007700]) { return [/color][color=#dd0000]" kém "[/color][color=#007700]; } return [/color][color=#dd0000]"nhập sai"[/color][color=#007700]; } public [/color][color=#0000bb]void hienthi[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"họ tên : " [/color][color=#007700]+ [/color][color=#0000bb]gethoten[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lớp : "[/color][color=#007700]+ [/color][color=#0000bb]getlophoc[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm toán : "[/color][color=#007700]+ [/color][color=#0000bb]gettoan[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm lý : "[/color][color=#007700]+ [/color][color=#0000bb]getly[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm hóa : "[/color][color=#007700]+ [/color][color=#0000bb]gethoa[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm tb : " [/color][color=#007700]+ [/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]gettoan[/color][color=#007700](),[/color][color=#0000bb]getly[/color][color=#007700](),[/color][color=#0000bb]gethoa[/color][color=#007700]())); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xếp hạng : "[/color][color=#007700]+[/color][color=#0000bb]xephang[/color][color=#007700]([/color][color=#0000bb]diemtb[/color][color=#007700]([/color][color=#0000bb]gettoan[/color][color=#007700](),[/color][color=#0000bb]getly[/color][color=#007700](),[/color][color=#0000bb]gethoa[/color][color=#007700]()))+ [/color][color=#dd0000]"
"[/color][color=#007700]); }}[/color]
Mã nguồn PHP:[color=#000000]
package nhansu[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#0000bb]import nhansu[/color][color=#007700].[/color][color=#0000bb]sinhvien[/color][color=#007700];[/color][color=#ff8000]/**** @author tran*/[/color][color=#007700]public class [/color][color=#0000bb]giangvien [/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700]; private [/color][color=#0000bb]string lopday[/color][color=#007700]; private [/color][color=#0000bb]int namsinh[/color][color=#007700]; private [/color][color=#0000bb]int luong[/color][color=#007700]; public [/color][color=#0000bb]string gethoten[/color][color=#007700]() { return [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700]; } public [/color][color=#0000bb]string getlopday[/color][color=#007700]() { return [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]void setlopday[/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]lopday [/color][color=#007700]= [/color][color=#0000bb]lopday[/color][color=#007700]; } public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() { return [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700]; } public [/color][color=#0000bb]int getluong[/color][color=#007700]() { return [/color][color=#0000bb]luong[/color][color=#007700]; } public [/color][color=#0000bb]void setluong[/color][color=#007700]([/color][color=#0000bb]int luong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]luong[/color][color=#007700]; } public [/color][color=#0000bb]void nhap[/color][color=#007700](){ [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập họ tên : "[/color][color=#007700]); [/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập lớp dạy : "[/color][color=#007700]); [/color][color=#0000bb]setlopday[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập năm sinh : "[/color][color=#007700]); [/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập lương : "[/color][color=#007700]); [/color][color=#0000bb]setluong[/color][color=#007700]([/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]()); } public [/color][color=#0000bb]boolean ktlop[/color][color=#007700]([/color][color=#0000bb]string lopday[/color][color=#007700], [/color][color=#0000bb]string lophoc[/color][color=#007700]){ if([/color][color=#0000bb]lopday[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]lophoc[/color][color=#007700])){ return [/color][color=#0000bb]true[/color][color=#007700]; } return [/color][color=#0000bb]false[/color][color=#007700]; } public [/color][color=#0000bb]void hienthi[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"họ tên : " [/color][color=#007700]+ [/color][color=#0000bb]gethoten[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lớp : "[/color][color=#007700]+ [/color][color=#0000bb]getlopday[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"năm sinh : "[/color][color=#007700]+ [/color][color=#0000bb]getnamsinh[/color][color=#007700]()); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"lương : "[/color][color=#007700]+ [/color][color=#0000bb]getluong[/color][color=#007700]()); } }[/color]
Mã nguồn PHP:[color=#000000]
[/color][color=#ff8000]/* * to change this license header, choose license headers in project properties.* to change this template file, choose tools | templates* and open the template in the editor.*/[/color][color=#0000bb]package nhansu[/color][color=#007700];[/color][color=#0000bb]import nhansu[/color][color=#007700].[/color][color=#0000bb]giangvien[/color][color=#007700];[/color][color=#0000bb]import nhansu[/color][color=#007700].[/color][color=#0000bb]sinhvien[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];[/color][color=#ff8000]/**** @author tran*/[/color][color=#007700]public class [/color][color=#0000bb]bai15 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]sinhvien a [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]giangvien b [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập thông tin sinh viên
"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thông tin sinh viên
"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]hienthi[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập thông tin giảng viên
"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thông tin giảng viên"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]hienthi[/color][color=#007700](); if ([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]ktlop[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700](), [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getlopday[/color][color=#007700]()) == [/color][color=#0000bb]true[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giảng viên " [/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" dạy lớp "[/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]()); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giảng viên "[/color][color=#007700]+ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]gethoten[/color][color=#007700]()+[/color][color=#dd0000]" không dạy lớp "[/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getlophoc[/color][color=#007700]()); } }}[/color]
-
10-11-2015, 07:00 AM #49Banned
- Ngày tham gia
- Apr 2014
- Bài viết
- 0
anh cho em hỏi tại sao mình phải dùng private cho các biến vậy . em không hiểu chỗ ấy ??
-
10-11-2015, 07:00 AM #50Junior Member
- Ngày tham gia
- May 2014
- Bài viết
- 0
Gửi bởi diend
mình cũng đang học nên cũng có thể chưa chuẩn xác lắm :d
chung cư cao cấp Millennium chủ đầu tư Masterise Homes ngân hàng hỗ trợ nhiều mảng xanh tiện nghi vô tận. Millennium canhomillennium ngân hàng hỗ trợ nhiều lựa chọn dự án trung tâm. Căn hộ chung cư...
Millennium sở hữu lâu dài nhất khu vực