-
05-09-2014, 07:00 AM #31Junior Member
- Ngày tham gia
- Feb 2015
- Bài viết
- 0
Mã nguồn PHP:[color=#000000]
khó hiểu quá[/color][color=#007700], [/color][color=#0000bb]hic[/color][color=#007700], [/color][color=#0000bb]chắc tại em còn non[/color][color=#007700]![/color]
<div class="attribution type"><noscript>kk (move your mouse to reveal the content)</noscript>
kk (open)
kk (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
</div>
</div>
-
-
07-08-2014, 07:00 AM #33Junior Member
- Ngày tham gia
- Feb 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>b1 (move your mouse to reveal the content)</noscript>
b1 (open)
b1 (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package edu[/color][color=#007700].[/color][color=#0000bb]dragon[/color][color=#007700].[/color][color=#0000bb]oop[/color][color=#007700]; public class [/color][color=#0000bb]constructor [/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]donhang donhang1 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"cpu"[/color][color=#007700], [/color][color=#dd0000]"001"[/color][color=#007700], [/color][color=#0000bb]200[/color][color=#007700], [/color][color=#0000bb]3[/color][color=#007700]); [/color][color=#0000bb]donhang donhang2 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"cpu"[/color][color=#007700], [/color][color=#dd0000]"001"[/color][color=#007700], [/color][color=#0000bb]200[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]0.7f[/color][color=#007700]); [/color][color=#0000bb]donhang1[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); [/color][color=#0000bb]donhang2[/color][color=#007700].[/color][color=#0000bb]show[/color][color=#007700](); }} class [/color][color=#0000bb]donhang[/color][color=#007700]{ private [/color][color=#0000bb]string tenhang[/color][color=#007700]; private [/color][color=#0000bb]string mahang[/color][color=#007700]; private [/color][color=#0000bb]float giaban[/color][color=#007700]; private [/color][color=#0000bb]int soluong[/color][color=#007700]; private [/color][color=#0000bb]float giamgia[/color][color=#007700]; public [/color][color=#0000bb]donhang[/color][color=#007700](){ } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]float giaban[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700]){ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]giaban[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/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]"tổng tiền:"[/color][color=#007700]+([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban[/color][color=#007700])); } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]float giaban[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700], [/color][color=#0000bb]float giamgia[/color][color=#007700]){ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]giaban[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia [/color][color=#007700]= [/color][color=#0000bb]giamgia[/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]"tổng tiền:"[/color][color=#007700]+([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban[/color][color=#007700]*[/color][color=#0000bb]giamgia[/color][color=#007700])); } public [/color][color=#0000bb]string gettenhang[/color][color=#007700]() { return [/color][color=#0000bb]tenhang[/color][color=#007700]; } public [/color][color=#0000bb]void settenhang[/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; } public [/color][color=#0000bb]string getmahang[/color][color=#007700]() { return [/color][color=#0000bb]mahang[/color][color=#007700]; } public [/color][color=#0000bb]void setmahang[/color][color=#007700]([/color][color=#0000bb]string mahang[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; } public [/color][color=#0000bb]float getgiaban[/color][color=#007700]() { return [/color][color=#0000bb]giaban[/color][color=#007700]; } public [/color][color=#0000bb]void setgiaban[/color][color=#007700]([/color][color=#0000bb]float giaban[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]giaban[/color][color=#007700]; } public [/color][color=#0000bb]int getsoluong[/color][color=#007700]() { return [/color][color=#0000bb]soluong[/color][color=#007700]; } public [/color][color=#0000bb]void setsoluong[/color][color=#007700]([/color][color=#0000bb]int soluong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; } public [/color][color=#0000bb]float getgiamgia[/color][color=#007700]() { return [/color][color=#0000bb]giamgia[/color][color=#007700]; } public [/color][color=#0000bb]void setgiamgia[/color][color=#007700]([/color][color=#0000bb]float giamgia[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia [/color][color=#007700]= [/color][color=#0000bb]giamgia[/color][color=#007700]; } public [/color][color=#0000bb]void show[/color][color=#007700](){ } }[/color]
</div>
</div>
-
09-09-2014, 07:00 AM #34Junior Member
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>btvn - constructor (move your mouse to reveal the content)</noscript>
btvn - constructor (open)
btvn - constructor (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package baitapvenha[/color][color=#007700];[/color][color=#ff8000]/*** bài 1: class đơn hàng có các thuộc tính: tên hàng, mã hàng, giá bán, số* lượng, tỷ lệ % giảm giá. tạo constructor có 4 thuộc tính đầu và thêm một* overload constructor với 5 thuộc tính . cả 2 constructor đều show ra tổng* tiền khi các đối tượng đơn hàng được tạo ra! (làm tương tự ví dụ trên).*/[/color][color=#007700]public class [/color][color=#0000bb]buoi19_constructor [/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]donhang dh1 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"100"[/color][color=#007700], [/color][color=#dd0000]"vo phuc karate"[/color][color=#007700], [/color][color=#0000bb]3[/color][color=#007700], [/color][color=#0000bb]100.6f[/color][color=#007700]); [/color][color=#0000bb]donhang dh2 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"101"[/color][color=#007700], [/color][color=#dd0000]"partin"[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]200[/color][color=#007700], [/color][color=#0000bb]0.3f[/color][color=#007700]); }} class [/color][color=#0000bb]donhang[/color][color=#007700]{ private [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700]; private [/color][color=#0000bb]int soluong[/color][color=#007700]; private [/color][color=#0000bb]float giaban[/color][color=#007700]; private [/color][color=#0000bb]float giamgia[/color][color=#007700]; public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700], [/color][color=#0000bb]float giaban[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]giaban[/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]"tong tien: "[/color][color=#007700]+[/color][color=#0000bb]soluong[/color][color=#007700]+[/color][color=#dd0000]"x"[/color][color=#007700]+[/color][color=#0000bb]giaban[/color][color=#007700]+[/color][color=#dd0000]" = "[/color][color=#007700]+([/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]giaban[/color][color=#007700])); } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700], [/color][color=#0000bb]float giaban[/color][color=#007700],[/color][color=#0000bb]float giamgia[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]giaban[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia [/color][color=#007700]= [/color][color=#0000bb]giamgia[/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]"tong tien: "[/color][color=#007700]+[/color][color=#0000bb]soluong[/color][color=#007700]+[/color][color=#dd0000]"x"[/color][color=#007700]+[/color][color=#0000bb]giaban[/color][color=#007700]+[/color][color=#dd0000]"x"[/color][color=#007700]+([/color][color=#0000bb]1[/color][color=#007700]-[/color][color=#0000bb]giamgia[/color][color=#007700])+[/color][color=#dd0000]" = "[/color][color=#007700]+([/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]giaban[/color][color=#007700]*([/color][color=#0000bb]1[/color][color=#007700]-[/color][color=#0000bb]giamgia[/color][color=#007700]))); } }[/color]
</div>
</div>
-
09-10-2014, 07:00 AM #35Junior Member
- Ngày tham gia
- Apr 2015
- Đang ở
- Đà Nẵng
- Bài viết
- 1
Gửi bởi kienit
-
09-10-2014, 07:00 AM #36Silver member
- Ngày tham gia
- Aug 2015
- Bài viết
- 32
Gửi bởi tuanleedragon
-
01-15-2015, 07:00 AM #37Junior Member
- Ngày tham gia
- May 2014
- Bài viết
- 1
<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 lesson19[/color][color=#007700]; class [/color][color=#0000bb]donhang [/color][color=#007700]{ private [/color][color=#0000bb]string tenhang[/color][color=#007700],[/color][color=#0000bb]mahang[/color][color=#007700]; private [/color][color=#0000bb]long gia[/color][color=#007700]; private [/color][color=#0000bb]int soluong[/color][color=#007700]; private [/color][color=#0000bb]int giamgia[/color][color=#007700]; public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700],[/color][color=#0000bb]string mahang[/color][color=#007700],[/color][color=#0000bb]long gia[/color][color=#007700],[/color][color=#0000bb]int soluong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/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]"tên hàng : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]+ [/color][color=#dd0000]" ma hang : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang[/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 ban : "[/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]+ [/color][color=#dd0000]" so luong : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/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]"tong: " [/color][color=#007700]+ ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia[/color][color=#007700])); } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700],[/color][color=#0000bb]string mahang[/color][color=#007700],[/color][color=#0000bb]long gia[/color][color=#007700],[/color][color=#0000bb]int soluong[/color][color=#007700],[/color][color=#0000bb]int giamgia[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia [/color][color=#007700]= [/color][color=#0000bb]giamgia[/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]"tên hàng : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]+ [/color][color=#dd0000]" ma hang : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang[/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 ban : "[/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]+ [/color][color=#dd0000]" so luong : " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/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]"giam gia : " [/color][color=#007700]+[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia[/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]"tong: " [/color][color=#007700]+ ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia[/color][color=#007700]*([/color][color=#0000bb]100[/color][color=#007700]-[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia[/color][color=#007700])/[/color][color=#0000bb]100[/color][color=#007700])); } }public class [/color][color=#0000bb]lesson19 [/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]donhang a [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"usb"[/color][color=#007700],[/color][color=#dd0000]"usb01001110"[/color][color=#007700],[/color][color=#0000bb]50000[/color][color=#007700],[/color][color=#0000bb]20[/color][color=#007700]); [/color][color=#0000bb]donhang b [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"usb"[/color][color=#007700],[/color][color=#dd0000]"usb01001100"[/color][color=#007700],[/color][color=#0000bb]50000[/color][color=#007700],[/color][color=#0000bb]10[/color][color=#007700],[/color][color=#0000bb]50[/color][color=#007700]); }}[/color]
</div>
</div>
-
01-21-2015, 07:00 AM #38Junior Member
- Ngày tham gia
- Jul 2015
- Bài viết
- 8
<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]
[/color][color=#007700]public class [/color][color=#0000bb]bai1_unit19 [/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]donhang d1 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"coffe"[/color][color=#007700],[/color][color=#dd0000]"ax1"[/color][color=#007700],[/color][color=#0000bb]30000f[/color][color=#007700],[/color][color=#0000bb]4[/color][color=#007700]); [/color][color=#0000bb]donhang d2 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"chocolate"[/color][color=#007700],[/color][color=#dd0000]"au3"[/color][color=#007700],[/color][color=#0000bb]20f[/color][color=#007700],[/color][color=#0000bb]6[/color][color=#007700],[/color][color=#0000bb]30[/color][color=#007700]); }} class [/color][color=#0000bb]donhang [/color][color=#007700]{ private [/color][color=#0000bb]string ten[/color][color=#007700]; private [/color][color=#0000bb]string ma[/color][color=#007700]; private [/color][color=#0000bb]float gia[/color][color=#007700]; private [/color][color=#0000bb]int soluong[/color][color=#007700]; private [/color][color=#0000bb]int percent[/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 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]string getma[/color][color=#007700]() { return [/color][color=#0000bb]ma[/color][color=#007700]; } public [/color][color=#0000bb]void setma[/color][color=#007700]([/color][color=#0000bb]string ma[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ma [/color][color=#007700]= [/color][color=#0000bb]ma[/color][color=#007700]; } public [/color][color=#0000bb]float getgia[/color][color=#007700]() { return [/color][color=#0000bb]gia[/color][color=#007700]; } public [/color][color=#0000bb]void setgia[/color][color=#007700]([/color][color=#0000bb]float gia[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700]; } public [/color][color=#0000bb]int getsoluong[/color][color=#007700]() { return [/color][color=#0000bb]soluong[/color][color=#007700]; } public [/color][color=#0000bb]void setsoluong[/color][color=#007700]([/color][color=#0000bb]int soluong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; } public [/color][color=#0000bb]int getpercent[/color][color=#007700]() { return [/color][color=#0000bb]percent[/color][color=#007700]; } public [/color][color=#0000bb]void setpercent[/color][color=#007700]([/color][color=#0000bb]int percent[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]percent [/color][color=#007700]= [/color][color=#0000bb]percent[/color][color=#007700]; } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string ten[/color][color=#007700], [/color][color=#0000bb]string ma[/color][color=#007700], [/color][color=#0000bb]float gia[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]ten[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ma [/color][color=#007700]= [/color][color=#0000bb]ma[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/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]"mat hang: " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" ban voi gia goc " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]+ [/color][color=#dd0000]"$" [/color][color=#007700]+ [/color][color=#dd0000]", so luong " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/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]"tong tien cua don hang " [/color][color=#007700]+ ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]) + [/color][color=#dd0000]"$"[/color][color=#007700]); } public [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string ten[/color][color=#007700], [/color][color=#0000bb]string ma[/color][color=#007700], [/color][color=#0000bb]float gia[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700], [/color][color=#0000bb]int percent[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]ten[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ma [/color][color=#007700]= [/color][color=#0000bb]ma[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]percent [/color][color=#007700]= [/color][color=#0000bb]percent[/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]"mat hang: " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" ban voi gia " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]+ [/color][color=#dd0000]"$" [/color][color=#007700]+ [/color][color=#dd0000]", so luong " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]+ [/color][color=#dd0000]" nhung duoc khuyen mai " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]percent [/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]"tong tien cua don hang " [/color][color=#007700]+ (float)(([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700])*([/color][color=#0000bb]100 [/color][color=#007700]- [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]percent[/color][color=#007700]) )/[/color][color=#0000bb]100 [/color][color=#007700]+ [/color][color=#dd0000]"$"[/color][color=#007700]); }}[/color]
</div>
</div>
-
05-01-2015, 07:00 AM #39Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>class donhang (move your mouse to reveal the content)</noscript>
class donhang (open)
class donhang (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package constructor[/color][color=#007700].[/color][color=#0000bb]phuong[/color][color=#007700].[/color][color=#0000bb]thuc[/color][color=#007700].[/color][color=#0000bb]khoi[/color][color=#007700].[/color][color=#0000bb]tao[/color][color=#007700]; class [/color][color=#0000bb]donhang [/color][color=#007700]{private [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700];private [/color][color=#0000bb]int gia[/color][color=#007700], [/color][color=#0000bb]soluong[/color][color=#007700];private [/color][color=#0000bb]float sale[/color][color=#007700]; public [/color][color=#0000bb]donhang [/color][color=#007700]() { } public [/color][color=#0000bb]donhang [/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]int gia[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/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]"tổng tiền là: " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia[/color][color=#007700]);} [/color][color=#ff8000]//overload constructor method[/color][color=#007700]public [/color][color=#0000bb]donhang [/color][color=#007700]([/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]string mahang[/color][color=#007700], [/color][color=#0000bb]int gia[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700], [/color][color=#0000bb]float sale[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]tenhang[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]mahang[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]gia[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]soluong[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]sale [/color][color=#007700]= [/color][color=#0000bb]sale[/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]"tổng tiền là: " [/color][color=#007700]+ ([/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]- [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]gia [/color][color=#007700]* [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]sale[/color][color=#007700]));}} public class [/color][color=#0000bb]demodonhang [/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]donhang a [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"kẹo cao su"[/color][color=#007700], [/color][color=#dd0000]"kcs001"[/color][color=#007700], [/color][color=#0000bb]5500[/color][color=#007700], [/color][color=#0000bb]5[/color][color=#007700]);[/color][color=#0000bb]donhang b [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"sữa"[/color][color=#007700], [/color][color=#dd0000]"s0002"[/color][color=#007700], [/color][color=#0000bb]5000[/color][color=#007700], [/color][color=#0000bb]12[/color][color=#007700], [/color][color=#0000bb]0.05f[/color][color=#007700]);}}[/color]
</div>
</div>
-
01-31-2016, 07:00 AM #40Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
Mã nguồn PHP:[color=#000000]
package androi[/color][color=#007700].[/color][color=#0000bb]vn[/color][color=#007700]; [/color][color=#ff8000]/** * bài 1: class đơn hàng có các thuộc tính: tên hàng, mã hàng, giá bán, số * lượng, tỷ lệ % giảm giá. tạo constructor có 4 thuộc tính đầu và thêm một * overload constructor với 5 thuộc tính . cả 2 constructor đều show ra tổng * tiền khi các đối tượng đơn hàng được tạo ra! (làm tương tự ví dụ trên). */ [/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]donhang [/color][color=#007700]{private [/color][color=#0000bb]string name20[/color][color=#007700], [/color][color=#0000bb]code20[/color][color=#007700];private [/color][color=#0000bb]int cost20[/color][color=#007700], [/color][color=#0000bb]many20[/color][color=#007700], [/color][color=#0000bb]giamgia20[/color][color=#007700]; public [/color][color=#0000bb]string getname20[/color][color=#007700]() {return [/color][color=#0000bb]name20[/color][color=#007700];} public [/color][color=#0000bb]void setname20[/color][color=#007700]([/color][color=#0000bb]string name20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name20 [/color][color=#007700]= [/color][color=#0000bb]name20[/color][color=#007700];} public [/color][color=#0000bb]string getcode20[/color][color=#007700]() {return [/color][color=#0000bb]code20[/color][color=#007700];} public [/color][color=#0000bb]void setcode20[/color][color=#007700]([/color][color=#0000bb]string code20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]code20 [/color][color=#007700]= [/color][color=#0000bb]code20[/color][color=#007700];} public [/color][color=#0000bb]int getcost20[/color][color=#007700]() {return [/color][color=#0000bb]cost20[/color][color=#007700];} public [/color][color=#0000bb]void setcost20[/color][color=#007700]([/color][color=#0000bb]int cost20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]cost20 [/color][color=#007700]= [/color][color=#0000bb]cost20[/color][color=#007700];} public [/color][color=#0000bb]int getmany20[/color][color=#007700]() {return [/color][color=#0000bb]many20[/color][color=#007700];} public [/color][color=#0000bb]void setmany20[/color][color=#007700]([/color][color=#0000bb]int many20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]many20 [/color][color=#007700]= [/color][color=#0000bb]many20[/color][color=#007700];} public [/color][color=#0000bb]int getgiamgia20[/color][color=#007700]() {return [/color][color=#0000bb]giamgia20[/color][color=#007700];} public [/color][color=#0000bb]void setgiamgia20[/color][color=#007700]([/color][color=#0000bb]int giamgia20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia20 [/color][color=#007700]= [/color][color=#0000bb]giamgia20[/color][color=#007700];} [/color][color=#ff8000]// constructor 1[/color][color=#0000bb]donhang[/color][color=#007700]() {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name20 [/color][color=#007700]= [/color][color=#dd0000]"kem"[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]code20 [/color][color=#007700]= [/color][color=#dd0000]"kt9"[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]cost20 [/color][color=#007700]= [/color][color=#0000bb]29000[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]many20 [/color][color=#007700]= [/color][color=#0000bb]25[/color][color=#007700];} [/color][color=#ff8000]// constructor 2[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string name20[/color][color=#007700], [/color][color=#0000bb]string code20[/color][color=#007700], [/color][color=#0000bb]int cost20[/color][color=#007700], [/color][color=#0000bb]int many20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name20 [/color][color=#007700]= [/color][color=#0000bb]name20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]code20 [/color][color=#007700]= [/color][color=#0000bb]code20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]cost20 [/color][color=#007700]= [/color][color=#0000bb]cost20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]many20 [/color][color=#007700]= [/color][color=#0000bb]many20[/color][color=#007700]; } [/color][color=#ff8000]// constructor 3[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#0000bb]string name20[/color][color=#007700], [/color][color=#0000bb]string code20[/color][color=#007700], [/color][color=#0000bb]int cost20[/color][color=#007700], [/color][color=#0000bb]int many20[/color][color=#007700], [/color][color=#0000bb]int giamgia20[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name20 [/color][color=#007700]= [/color][color=#0000bb]name20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]code20 [/color][color=#007700]= [/color][color=#0000bb]code20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]cost20 [/color][color=#007700]= [/color][color=#0000bb]cost20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]many20 [/color][color=#007700]= [/color][color=#0000bb]many20[/color][color=#007700];[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia20 [/color][color=#007700]= [/color][color=#0000bb]giamgia20[/color][color=#007700]; } public [/color][color=#0000bb]void input20[/color][color=#007700]() {[/color][color=#0000bb]scanner scanner20 [/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]"ten hang: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name20 [/color][color=#007700]= [/color][color=#0000bb]scanner20[/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]"ma hang: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]code20 [/color][color=#007700]= [/color][color=#0000bb]scanner20[/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]"don gia: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]cost20 [/color][color=#007700]= [/color][color=#0000bb]scanner20[/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]"so luong:"[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]many20 [/color][color=#007700]= [/color][color=#0000bb]scanner20[/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]"% giam gia cua khach hang: "[/color][color=#007700]);[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]giamgia20 [/color][color=#007700]= [/color][color=#0000bb]scanner20[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } public [/color][color=#0000bb]long show20[/color][color=#007700]([/color][color=#0000bb]int cost20[/color][color=#007700], [/color][color=#0000bb]int many20[/color][color=#007700]) {[/color][color=#0000bb]long tongtien20 [/color][color=#007700]= [/color][color=#0000bb]cost20 [/color][color=#007700]* [/color][color=#0000bb]many20[/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]" don hang vua xuat la:"[/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]"ten hang: " [/color][color=#007700]+ [/color][color=#0000bb]name20[/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]"ma hang: " [/color][color=#007700]+ [/color][color=#0000bb]code20[/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]"don gia: " [/color][color=#007700]+ [/color][color=#0000bb]cost20 [/color][color=#007700]+ [/color][color=#dd0000]" (vnd)"[/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]"so luong: " [/color][color=#007700]+ [/color][color=#0000bb]many20[/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]"tong tien thu duoc: " [/color][color=#007700]+ [/color][color=#0000bb]tongtien20 [/color][color=#007700]+ [/color][color=#dd0000]" (vnd)"[/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]"(khach hang khong duoc giam gia)"[/color][color=#007700]);return [/color][color=#0000bb]tongtien20[/color][color=#007700];} [/color][color=#ff8000]// overload[/color][color=#007700]public [/color][color=#0000bb]long show20[/color][color=#007700]([/color][color=#0000bb]int cost20[/color][color=#007700], [/color][color=#0000bb]int many20[/color][color=#007700], [/color][color=#0000bb]int giamgia20[/color][color=#007700]) {[/color][color=#0000bb]long tongtien20 [/color][color=#007700]= [/color][color=#0000bb]cost20 [/color][color=#007700]* [/color][color=#0000bb]many20 [/color][color=#007700]* [/color][color=#0000bb]giamgia20 [/color][color=#007700]/ [/color][color=#0000bb]100[/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]" don hang vua xuat la:"[/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]"ten hang: " [/color][color=#007700]+ [/color][color=#0000bb]name20[/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]"ma hang: " [/color][color=#007700]+ [/color][color=#0000bb]code20[/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]"don gia: " [/color][color=#007700]+ [/color][color=#0000bb]cost20 [/color][color=#007700]+ [/color][color=#dd0000]" (vnd)"[/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]"so luong: " [/color][color=#007700]+ [/color][color=#0000bb]many20[/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]"tong tien thu duoc: " [/color][color=#007700]+ [/color][color=#0000bb]tongtien20 [/color][color=#007700]+ [/color][color=#dd0000]" (vnd)"[/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]"(khach hang duoc giam gia: " [/color][color=#007700]+ [/color][color=#0000bb]giamgia20 [/color][color=#007700]+ [/color][color=#dd0000]"%)"[/color][color=#007700]);return [/color][color=#0000bb]tongtien20[/color][color=#007700]; } public [/color][color=#0000bb]long paybill[/color][color=#007700]([/color][color=#0000bb]int a[/color][color=#007700], [/color][color=#0000bb]int b[/color][color=#007700]) {return [/color][color=#0000bb]a [/color][color=#007700]* [/color][color=#0000bb]b[/color][color=#007700];} public [/color][color=#0000bb]long paybill[/color][color=#007700]([/color][color=#0000bb]int a[/color][color=#007700], [/color][color=#0000bb]int b[/color][color=#007700], [/color][color=#0000bb]int c[/color][color=#007700]) {return [/color][color=#0000bb]a [/color][color=#007700]* [/color][color=#0000bb]b [/color][color=#007700]* [/color][color=#0000bb]c [/color][color=#007700]/ [/color][color=#0000bb]100[/color][color=#007700];} [/color][color=#ff8000]// overload[/color][color=#007700]public [/color][color=#0000bb]void output20[/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]"tong tien chua khuyen mai: " [/color][color=#007700]+ [/color][color=#0000bb]paybill[/color][color=#007700]([/color][color=#0000bb]cost20[/color][color=#007700], [/color][color=#0000bb]many20[/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]"tong tien sau khuyen mai " [/color][color=#007700]+ [/color][color=#0000bb]giamgia20 [/color][color=#007700]+ [/color][color=#dd0000]"% la: " [/color][color=#007700]+ [/color][color=#0000bb]paybill[/color][color=#007700]([/color][color=#0000bb]cost20[/color][color=#007700], [/color][color=#0000bb]many20[/color][color=#007700], [/color][color=#0000bb]giamgia20[/color][color=#007700])); }} public class [/color][color=#0000bb]bai19 [/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 hoadon [/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]donhang a [/color][color=#007700]= new [/color][color=#0000bb]donhang[/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]"moi nhap thong tin hang vua ban: "[/color][color=#007700]);[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]input20[/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]"vui long chon loai hoa don:"[/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]"1.full bill: "[/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]"2. part bill : "[/color][color=#007700]);[/color][color=#0000bb]byte x [/color][color=#007700]= [/color][color=#0000bb]hoadon[/color][color=#007700].[/color][color=#0000bb]nextbyte[/color][color=#007700](); if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]1[/color][color=#007700]) {if ([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getgiamgia20[/color][color=#007700]() == [/color][color=#0000bb]0[/color][color=#007700]) {[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]show20[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getcost20[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getmany20[/color][color=#007700]());} else {[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]show20[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getcost20[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getmany20[/color][color=#007700](), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]getgiamgia20[/color][color=#007700]());}} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]2[/color][color=#007700]) {[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]output20[/color][color=#007700]();}}}[/color]
ad test giúp em với nhé!
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