-
08-23-2013, 07:00 AM #11Junior Member
- Ngày tham gia
- Apr 2014
- Bài viết
- 0
nộp bài nek
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package [/color][color=#007700]class;[/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]{ public [/color][color=#0000bb]string hoten[/color][color=#007700]; public [/color][color=#0000bb]int namsinh[/color][color=#007700]; public [/color][color=#0000bb]double diemtb[/color][color=#007700];}public class [/color][color=#0000bb]democlass[/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]sinhvien b [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700](); [/color][color=#0000bb]scanner nhapdulieu [/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]"nhap ho ten hoc sinh thu 1 "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]a[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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 trung binh "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700](); [/color][color=#0000bb]nhapdulieu[/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 ho ten hoc sinh thu 2 "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]namsinh [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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 trung binh "[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700](); if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]> [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]diemtb[/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 co diem cao hon la "[/color][color=#007700]+[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]hoten[/color][color=#007700]); } else if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]diemtb[/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 co diem cao hon la "[/color][color=#007700]+[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]hoten[/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]"hai sinh vien bang diem nhau"[/color][color=#007700]); }}[/color]
</div>
</div>
-
08-27-2013, 07:00 AM #12Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
Mã nguồn PHP:[color=#000000]
kien[/color]
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
</div>
</div>package edu.kien.oo;
import java.util.scanner;
class sinhvienoo {
public string hoten;
public string lop;
public double dtb;
}
public class sinhvien1 {
public static void main(string[] args) {
scanner nhap = new scanner(system.in);
sinhvienoo a = new sinhvienoo();
sinhvienoo b = new sinhvienoo();
system.out.println("nhap ten");
a.hoten = nhap.nextline();
b.hoten = nhap.nextline();
system.out.println("nhap lop:");
a.lop = nhap.nextline();
b.lop = nhap.nextline();
system.out.println("diem trung binh");
a.dtb = nhap.nextdouble();
b.dtb = nhap.nextdouble();
if (a.dtb > b.dtb) {
system.out.println("hoten" + a.hoten + "lop" + a.lop + "diemtb"
+ a.dtb + " diem tb cao hon");
} else if (a.dtb < b.dtb) {
system.out.println("hoten" + b.hoten + "lop" + b.lop + "diemtb"
+ b.dtb + "diem tb cao hon");
} else {
system.out.println("diem tb bang nhau");
}
}
}
Mã nguồn PHP:[color=#000000]
[/color]
-
09-08-2013, 07:00 AM #13Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:package javaandroid.vn; import java.util.scanner; public class btbai12 { public static void main(string[]args){ scanner in=new scanner(system.in); hocsinh a=new hocsinh(); hocsinh b=new hocsinh(); system.out.println("nhap thong tin hs a:"); system.out.print("ho ten: "); a.hoten=in.nextline(); system.out.print("lop: "); a.lop=in.nextline(); system.out.print("dtb: "); a.dtb=in.nextint(); in.nextline(); system.out.println("nhap thong tin hs b:"); system.out.print("ho ten: "); b.hoten=in.nextline(); system.out.print("lop: "); b.lop=in.nextline(); system.out.print("dtb: "); b.dtb=in.nextint();//so sanh if(a.dtb>b.dtb){ system.out.println("thong tin hs a:ten: "+a.hoten+",lop: "+a.lop+",dtb: "+a.dtb); } else { system.out.println("thong tin hs a:ten: "+b.hoten+",lop: "+b.lop+",dtb: "+b.dtb); } } } class hocsinh{ public string hoten; public string lop; public int dtb; }
</div>
</div>
-
09-11-2013, 07:00 AM #14Junior Member
- Ngày tham gia
- Mar 2014
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã://tạo class hocsinh gồm 3 thuộc tính: họ tên, lớp, điểm trung bình. //tạo 2 đối tượng học sinh a và học sinh b, giá trị của các thuộc tính của 2 đối tượng //được nhập từ bàn phím. //so sánh điểm trung bình giữa 2 đối tượng tìm ra người có điểm cao hơn báo ra màn hình console! package unit1; import java.util.scanner; public class unit1 { public static void main(string[] args) { scanner in = new scanner(system.in); sinhvien a = new sinhvien(); system.out.println("nhap ten: "); a.name = in.nextline(); system.out.println("nhap nam sinh: "); a.age = in.nextint(); system.out.println("nhap diem trung binh: "); a.tb = in.nextfloat(); in.nextline(); sinhvien b = new sinhvien(); system.out.println("nhap ten: "); b.name = in.nextline(); system.out.println("nhap nam sinh: "); b.age = in.nextint(); system.out.println("nhap diem trung binh: "); b.tb = in.nextfloat(); if (a.tb>b.tb){ system.out.println("sinh vien "+a.name +" sinh nam " + a.age +" co diem trung binh la " +a.tb); } else if (a.tb <b.tb) { system.out.println("sinh vien "+b.name +" sinh nam " + b.age +" co diem trung binh la " +b.tb); } else { system.out.println("sinh vien co diem trung binh bang nhau"); } } } class sinhvien { public string name; public int age; public float tb; }
</div>
</div>
-
09-14-2013, 07:00 AM #15Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
Mã nguồn PHP:[color=#000000]
never think i cannot champian[/color][color=#007700].[/color][color=#0000bb]i want to bevome a proffesional programing[/color][color=#007700].do [/color][color=#0000bb]you understand[/color][color=#007700]?[/color]
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package structure[/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]; public class [/color][color=#0000bb]student [/color][color=#007700]{ [/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]classmate[/color][color=#007700]; [/color][color=#0000bb]int score[/color][color=#007700]; [/color][color=#ff8000]//set the name, classmate, score. [/color][color=#007700]public [/color][color=#0000bb]void input[/color][color=#007700](){ [/color][color=#0000bb]scanner in [/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]"entry the name of student: "[/color][color=#007700]); [/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"entry the nameclass: "[/color][color=#007700]); [/color][color=#0000bb]classmate [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"entry the score average:"[/color][color=#007700]); [/color][color=#0000bb]score [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); }[/color][color=#ff8000]//method input. [/color][color=#007700]public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string args [/color][color=#007700][]){ [/color][color=#ff8000]//object creation. [/color][color=#0000bb]student persiona [/color][color=#007700]= new [/color][color=#0000bb]student[/color][color=#007700](); [/color][color=#0000bb]student persionb [/color][color=#007700]= new [/color][color=#0000bb]student[/color][color=#007700](); [/color][color=#ff8000]//call class method to set name, score and classmate. [/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#ff8000]//compare. [/color][color=#007700]if([/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]score [/color][color=#007700]> [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]score [/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]"studena is winer"[/color][color=#007700]); } else if([/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]score [/color][color=#007700]< [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]score[/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]"studenb is a winner!"[/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]"the have similar values!"[/color][color=#007700]); }[/color][color=#ff8000]//end the main. [/color][color=#007700]}[/color][color=#ff8000]//end the class student.[/color]
</div>
</div>
-
09-14-2013, 07:00 AM #16Banned
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
Mã nguồn PHP:[color=#000000]
never think i cannot champian[/color][color=#007700].[/color][color=#0000bb]i want to bevome a proffesional programing[/color][color=#007700].do [/color][color=#0000bb]you understand[/color][color=#007700]?[/color]
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package structure[/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]; public class [/color][color=#0000bb]student [/color][color=#007700]{ [/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]classmate[/color][color=#007700]; [/color][color=#0000bb]int score[/color][color=#007700]; [/color][color=#ff8000]//set the name, classmate, score. [/color][color=#007700]public [/color][color=#0000bb]void input[/color][color=#007700](){ [/color][color=#0000bb]scanner in [/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]"entry the name of student: "[/color][color=#007700]); [/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"entry the nameclass: "[/color][color=#007700]); [/color][color=#0000bb]classmate [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"entry the score average:"[/color][color=#007700]); [/color][color=#0000bb]score [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); }[/color][color=#ff8000]//method input. [/color][color=#007700]public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string args [/color][color=#007700][]){ [/color][color=#ff8000]//object creation. [/color][color=#0000bb]student persiona [/color][color=#007700]= new [/color][color=#0000bb]student[/color][color=#007700](); [/color][color=#0000bb]student persionb [/color][color=#007700]= new [/color][color=#0000bb]student[/color][color=#007700](); [/color][color=#ff8000]//call class method to set name, score and classmate. [/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#ff8000]//compare. [/color][color=#007700]if([/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]score [/color][color=#007700]> [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]score [/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]"studena is winer"[/color][color=#007700]); } else if([/color][color=#0000bb]persiona[/color][color=#007700].[/color][color=#0000bb]score [/color][color=#007700]< [/color][color=#0000bb]persionb[/color][color=#007700].[/color][color=#0000bb]score[/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]"studenb is a winner!"[/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]"the have similar values!"[/color][color=#007700]); }[/color][color=#ff8000]//end the main. [/color][color=#007700]}[/color][color=#ff8000]//end the class student.[/color]
</div>
</div>
-
09-15-2013, 07:00 AM #17Senior Member
- Ngày tham gia
- Mar 2016
- Bài viết
- 365
tựa nhau tý thôi...
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package structure[/color][color=#007700]; public class [/color][color=#0000bb]employee [/color][color=#007700]{ [/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]designation[/color][color=#007700]; [/color][color=#0000bb]int age[/color][color=#007700]; [/color][color=#0000bb]double salary[/color][color=#007700]; [/color][color=#ff8000]//this is the constructor of the class employee. [/color][color=#007700]public [/color][color=#0000bb]employee[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700]){ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700]; } [/color][color=#ff8000]//assign the age of the employee to the variable age. [/color][color=#007700]public [/color][color=#0000bb]void empage[/color][color=#007700]( [/color][color=#0000bb]int empage[/color][color=#007700]){ [/color][color=#0000bb]age [/color][color=#007700]= [/color][color=#0000bb]empage[/color][color=#007700]; } [/color][color=#ff8000]//assign the designation of the variable designation. [/color][color=#007700]public [/color][color=#0000bb]void empdesign[/color][color=#007700]( [/color][color=#0000bb]string empdesign[/color][color=#007700]){ [/color][color=#0000bb]designation [/color][color=#007700]= [/color][color=#0000bb]empdesign[/color][color=#007700]; } [/color][color=#ff8000]//assign the salary of the variable salary. [/color][color=#007700]public [/color][color=#0000bb]void empsalary[/color][color=#007700]([/color][color=#0000bb]double empsalary[/color][color=#007700]){ [/color][color=#0000bb]salary [/color][color=#007700]= [/color][color=#0000bb]empsalary[/color][color=#007700]; } [/color][color=#ff8000]// print the class employee details. [/color][color=#007700]public [/color][color=#0000bb]void showemployee[/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]"name: "[/color][color=#007700]+[/color][color=#0000bb]name[/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]"age: "[/color][color=#007700]+[/color][color=#0000bb]age[/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]"designation: "[/color][color=#007700]+[/color][color=#0000bb]designation[/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]"salary: "[/color][color=#007700]+[/color][color=#0000bb]salary[/color][color=#007700]); } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string args[/color][color=#007700][]){ [/color][color=#ff8000]//creation object. [/color][color=#0000bb]employee empone [/color][color=#007700]= new [/color][color=#0000bb]employee[/color][color=#007700]([/color][color=#dd0000]"kiet ho hoai"[/color][color=#007700]); [/color][color=#0000bb]employee emptwo [/color][color=#007700]= new [/color][color=#0000bb]employee[/color][color=#007700]([/color][color=#dd0000]"nam ho hoai"[/color][color=#007700]); [/color][color=#ff8000]//imvoking method for each object created [/color][color=#0000bb]empone[/color][color=#007700].[/color][color=#0000bb]empage[/color][color=#007700]([/color][color=#0000bb]20[/color][color=#007700]); [/color][color=#0000bb]empone[/color][color=#007700].[/color][color=#0000bb]empdesign[/color][color=#007700]([/color][color=#dd0000]"student"[/color][color=#007700]); [/color][color=#0000bb]empone[/color][color=#007700].[/color][color=#0000bb]empsalary[/color][color=#007700]([/color][color=#0000bb]5000[/color][color=#007700]); [/color][color=#ff8000]//invoking method for each object created. [/color][color=#0000bb]emptwo[/color][color=#007700].[/color][color=#0000bb]empage[/color][color=#007700]([/color][color=#0000bb]26[/color][color=#007700]); [/color][color=#0000bb]emptwo[/color][color=#007700].[/color][color=#0000bb]empdesign[/color][color=#007700]([/color][color=#dd0000]"engineer"[/color][color=#007700]); [/color][color=#0000bb]emptwo[/color][color=#007700].[/color][color=#0000bb]empsalary[/color][color=#007700]([/color][color=#0000bb]6000[/color][color=#007700]); [/color][color=#ff8000]//print on the console. [/color][color=#0000bb]empone[/color][color=#007700].[/color][color=#0000bb]showemployee[/color][color=#007700](); [/color][color=#0000bb]emptwo[/color][color=#007700].[/color][color=#0000bb]showemployee[/color][color=#007700](); }[/color][color=#ff8000]//main.[/color][color=#007700]}[/color][color=#ff8000]//end the class employee.[/color]
</div>
</div>
-
10-21-2013, 07:00 AM #18Junior Member
- Ngày tham gia
- Jul 2015
- Bài viết
- 2
đây là bài của mình, mong các bạn đóng góp ý kiến: :d
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package com[/color][color=#007700].[/color][color=#0000bb]hanhnv[/color][color=#007700].[/color][color=#0000bb]core[/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]; public class [/color][color=#0000bb]bai12 [/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 s [/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]pupil a [/color][color=#007700]= new [/color][color=#0000bb]pupil[/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]"enter name of pupil 1:"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]fullname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700].[/color][color=#0000bb]equals[/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]"fullname mustn\'t empty, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]fullname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"enter pupil 1\'s class name:"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]classname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]classname[/color][color=#007700].[/color][color=#0000bb]equals[/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]"class name mustn\'t empty, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]classname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"enter pupil 1\'s everage mark:"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]everagemark [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); while ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]everagemark[/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]"everage mark mustn\'t less than 0, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]everagemark [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]pupil b [/color][color=#007700]= new [/color][color=#0000bb]pupil[/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]"enter name of pupil 2:"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]fullname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700].[/color][color=#0000bb]equals[/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]"fullname mustn\'t empty, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]fullname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"enter pupil 2\'s class name:"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]classname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]classname[/color][color=#007700].[/color][color=#0000bb]equals[/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]"class name mustn\'t empty, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]classname [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/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]"enter pupil 2\'s everage mark:"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]everagemark [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); while ([/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]everagemark[/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]"everage mark mustn\'t less than 0, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]everagemark [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]everagemark[/color][color=#007700]>[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]everagemark[/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]a[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s everage mark is higher than "[/color][color=#007700]+[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s."[/color][color=#007700]); } else if([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]everagemark[/color][color=#007700]<[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]everagemark[/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]b[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s everage mark is higher than "[/color][color=#007700]+[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s."[/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=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s everage mark equals "[/color][color=#007700]+[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]fullname[/color][color=#007700]+[/color][color=#dd0000]"\'s."[/color][color=#007700]); } }class [/color][color=#0000bb]pupil[/color][color=#007700]{ public [/color][color=#0000bb]string fullname[/color][color=#007700]; public [/color][color=#0000bb]string classname[/color][color=#007700]; public [/color][color=#0000bb]float everagemark[/color][color=#007700];}[/color]
</div>
</div>
-
10-23-2013, 07:00 AM #19Junior Member
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
Gửi bởi kienit
-
11-05-2013, 07:00 AM #20Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
mong mọi người xem và đánh giá giúp.
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package baitap[/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]//tạo class hocsinh gồm 3 thuộc tính: họ tên, lớp, điểm trung bình.//tạo 2 đối tượng học sinh a và học sinh b, giá trị của các thuộc tính của 2 đối tượng//được nhập từ bàn phím. so sánh điểm trung bình giữa 2 đối tượng tìm ra người có điểm cao hơn báo ra màn hình console![/color][color=#007700]class [/color][color=#0000bb]hocsinh[/color][color=#007700]{ private [/color][color=#0000bb]string hoten[/color][color=#007700]; private [/color][color=#0000bb]string lop[/color][color=#007700]; private [/color][color=#0000bb]float diemtb[/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 getlop[/color][color=#007700]() { return [/color][color=#0000bb]lop[/color][color=#007700]; } public [/color][color=#0000bb]float getdiemtb[/color][color=#007700]() { return [/color][color=#0000bb]diemtb[/color][color=#007700]; } public [/color][color=#0000bb]void nhaptt[/color][color=#007700](){ [/color][color=#0000bb]scanner scan[/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]"
họ tên:"[/color][color=#007700]); [/color][color=#0000bb]hoten[/color][color=#007700]=[/color][color=#0000bb]scan[/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]scan[/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]"
điểm trung bình:"[/color][color=#007700]); [/color][color=#0000bb]diemtb[/color][color=#007700]=[/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } public [/color][color=#0000bb]void hientt[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]hoten[/color][color=#007700]+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]lop[/color][color=#007700]+[/color][color=#dd0000]"\t"[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]+[/color][color=#dd0000]"
"[/color][color=#007700]); }}public class [/color][color=#0000bb]baitap [/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]hocsinh a[/color][color=#007700],[/color][color=#0000bb]b[/color][color=#007700]; [/color][color=#0000bb]a[/color][color=#007700]=new [/color][color=#0000bb]hocsinh[/color][color=#007700](); [/color][color=#0000bb]b[/color][color=#007700]=new [/color][color=#0000bb]hocsinh[/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 học sinh a:"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]nhaptt[/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 học sinh b:"[/color][color=#007700]); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]nhaptt[/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 các học sinh vừa nhập"[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]hientt[/color][color=#007700](); [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]hientt[/color][color=#007700](); [/color][color=#ff8000]//so sánh điểm trung bình [/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ọc sinh có điểm trung bình cao hơn"[/color][color=#007700]); if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getdiemtb[/color][color=#007700]()>[/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]getdiemtb[/color][color=#007700]()){ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]hientt[/color][color=#007700](); } else{ [/color][color=#0000bb]b[/color][color=#007700].[/color][color=#0000bb]hientt[/color][color=#007700](); } } }[/color]
</div>
</div>
Khu chung cư cao cấp The Esme Dĩ An đầu tư bởi Công ty TNHH Đầu tư Xây dựng Thiên Hà – Băng Dương văn hoá đa dạng gần trung tâm đầu tư dài hạn. The Esme Dĩ An giagocchudautu.com văn hoá đa dạng...
Dự án chung cư The Esme Dĩ An sát trung tâm