-
08-09-2013, 07:00 AM #11Banned
- Ngày tham gia
- Jul 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ã nguồn PHP:[color=#000000]
package hanghoa[/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ên hàng,mã hàng,số lượng hàng,giá hàng //mua vào 8h->17h giảm 5% //tạo phương thức tính tổng tiền //tạo đối tượng nhập vào từ console[/color][color=#007700]class [/color][color=#0000bb]hanghoa [/color][color=#007700]{ public [/color][color=#0000bb]string tenhang[/color][color=#007700]; public [/color][color=#0000bb]string mahang[/color][color=#007700]; public [/color][color=#0000bb]int soluonghang[/color][color=#007700]; public [/color][color=#0000bb]float giahang[/color][color=#007700]; public [/color][color=#0000bb]int time[/color][color=#007700]; public [/color][color=#0000bb]float tongtien[/color][color=#007700]; public [/color][color=#0000bb]void nhap[/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]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập vào tên hàng: "[/color][color=#007700]); [/color][color=#0000bb]tenhang[/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]"nhập vào mã hàng: "[/color][color=#007700]); [/color][color=#0000bb]mahang[/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]"nhập vào số lượng hàng: "[/color][color=#007700]); [/color][color=#0000bb]soluonghang[/color][color=#007700]=[/color][color=#0000bb]s[/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]"nhập vào giá hàng: "[/color][color=#007700]); [/color][color=#0000bb]giahang[/color][color=#007700]=[/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); try { [/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 vào thời gian"[/color][color=#007700]); [/color][color=#0000bb]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]time [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if (([/color][color=#0000bb]time[/color][color=#007700]>[/color][color=#0000bb]24[/color][color=#007700]) ||([/color][color=#0000bb]time[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700])) { throw new [/color][color=#0000bb]exception[/color][color=#007700](); } } catch([/color][color=#0000bb]exception e[/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 sai thời gian! "[/color][color=#007700]); exit(); } } public [/color][color=#0000bb]void xuat[/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 là: "[/color][color=#007700]+[/color][color=#0000bb]tenhang[/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]"mã hàng là: "[/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]"số lượng hàng là: "[/color][color=#007700]+[/color][color=#0000bb]soluonghang[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giá hàng là: "[/color][color=#007700]+[/color][color=#0000bb]giahang[/color][color=#007700]); if(([/color][color=#0000bb]time[/color][color=#007700]>[/color][color=#0000bb]8[/color][color=#007700])&&([/color][color=#0000bb]time[/color][color=#007700]<[/color][color=#0000bb]17[/color][color=#007700])){ [/color][color=#0000bb]tongtien[/color][color=#007700]=([/color][color=#0000bb]soluonghang[/color][color=#007700]+[/color][color=#0000bb]giahang[/color][color=#007700])-(([/color][color=#0000bb]soluonghang[/color][color=#007700]+[/color][color=#0000bb]giahang[/color][color=#007700])*[/color][color=#0000bb]5[/color][color=#007700])/[/color][color=#0000bb]100[/color][color=#007700]; } else{ [/color][color=#0000bb]tongtien[/color][color=#007700]=[/color][color=#0000bb]soluonghang[/color][color=#007700]+[/color][color=#0000bb]giahang[/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 số tiền là: "[/color][color=#007700]+[/color][color=#0000bb]tongtien[/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]hanghoa hh[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]xuat[/color][color=#007700](); } private [/color][color=#0000bb]void [/color][color=#007700]exit() { throw new [/color][color=#0000bb]unsupportedoperationexception[/color][color=#007700]([/color][color=#dd0000]"not yet implemented"[/color][color=#007700]); }}[/color]
</div>
</div>
-
09-09-2013, 07:00 AM #12Junior Member
- Ngày tham gia
- Jun 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ã:package javaandroid.vn; import java.util.scanner; class hanghoa{ public string tenhang; public string mahang; public float giahang; public int soluong; public float thoigianmua; public float tongtien; public void tinhs(){ if(thoigianmua>=8 && thoigianmua<=17){ giahang =(giahang*95/100); } tongtien=giahang*soluong; system.out.println("tong tien thanh toan: "+tongtien); // return tongtien; } public void ttmuahang(){ system.out.print(tenhang); system.out.print("\t"+mahang); system.out.print("\t"+giahang); system.out.print("\t"+soluong); system.out.print("\t"+thoigianmua+" "); tinhs(); } } public class btbai14 { public static void main(string[]args){ scanner in=new scanner(system.in); hanghoa h=new hanghoa(); system.out.print("ten hang: "); h.tenhang=in.nextline(); system.out.print("ma hang: "); h.mahang=in.nextline(); system.out.print("gia: "); h.giahang=in.nextfloat(); system.out.print("so luong: "); h.soluong=in.nextint(); system.out.print("thoi gian mua: "); h.thoigianmua=in.nextfloat(); in.nextline(); system.out.println("thong tin mua hang: "); h.ttmuahang(); } }
</div>
</div>
-
-
09-16-2013, 07:00 AM #14Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
đã ngâm cứu kỹ. english và android.vn
thanks tiasangmoi92
-
09-17-2013, 07:00 AM #15Junior Member
- Ngày tham gia
- May 2014
- Bài viết
- 4
dạo này load lâu dử. không thôi cũng được fan like nhiều rồi.
mong được sử sai để thấy lổi của mình.
<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];[/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]hanghoa [/color][color=#007700]{ [/color][color=#0000bb]string ten[/color][color=#007700], [/color][color=#0000bb]ma[/color][color=#007700]; static [/color][color=#0000bb]int gia[/color][color=#007700]; static [/color][color=#0000bb]int soluong[/color][color=#007700]; static [/color][color=#0000bb]int time[/color][color=#007700]; private [/color][color=#0000bb]scanner in[/color][color=#007700]; public [/color][color=#0000bb]void input[/color][color=#007700]() { [/color][color=#0000bb]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]"nhapten: "[/color][color=#007700]); [/color][color=#0000bb]ten [/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]"nhapma: "[/color][color=#007700]); [/color][color=#0000bb]ma [/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]"nhapgia "[/color][color=#007700]); [/color][color=#0000bb]gia [/color][color=#007700]= [/color][color=#0000bb]in[/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]"nhapsoluong"[/color][color=#007700]); [/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhapthoigianmua "[/color][color=#007700]); [/color][color=#0000bb]time [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } while( [/color][color=#0000bb]time [/color][color=#007700]<[/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]time[/color][color=#007700]>[/color][color=#0000bb]24 [/color][color=#007700]); }[/color][color=#ff8000]//method input. [/color][color=#007700]public [/color][color=#0000bb]float sum[/color][color=#007700]([/color][color=#0000bb]int gia[/color][color=#007700], [/color][color=#0000bb]int soluong [/color][color=#007700]) { if([/color][color=#0000bb]time [/color][color=#007700]>=[/color][color=#0000bb]5 [/color][color=#007700]&& [/color][color=#0000bb]time[/color][color=#007700]<=[/color][color=#0000bb]17 [/color][color=#007700]) return ((float) ([/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]gia[/color][color=#007700])*((float) [/color][color=#0000bb]95[/color][color=#007700]/[/color][color=#0000bb]100[/color][color=#007700]) ); else return ([/color][color=#0000bb]soluong[/color][color=#007700]*[/color][color=#0000bb]gia[/color][color=#007700]); }[/color][color=#ff8000]// method sum. [/color][color=#007700]public [/color][color=#0000bb]void show[/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]"nguoi mua: "[/color][color=#007700]+[/color][color=#0000bb]ten[/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]ma[/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]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]"gia san pham: "[/color][color=#007700]+[/color][color=#0000bb]gia[/color][color=#007700]); }[/color][color=#ff8000]//method show. [/color][color=#007700]public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string args [/color][color=#007700][]) { [/color][color=#0000bb]hanghoa in [/color][color=#007700]= new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700](); [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]show[/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]in[/color][color=#007700].[/color][color=#0000bb]sum[/color][color=#007700]([/color][color=#0000bb]gia[/color][color=#007700], [/color][color=#0000bb]soluong[/color][color=#007700])); }}[/color][color=#ff8000]// class hanghoa.[/color]
</div>
</div>
-
10-22-2013, 07:00 AM #16Junior Member
- Ngày tham gia
- Mar 2014
- Bài viết
- 0
đây là bài của mình: :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]bai14 [/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]goods goods [/color][color=#007700]= new [/color][color=#0000bb]goods[/color][color=#007700](); [/color][color=#0000bb]goods[/color][color=#007700].[/color][color=#0000bb]inputgoods[/color][color=#007700](); [/color][color=#0000bb]goods[/color][color=#007700].[/color][color=#0000bb]showgoods[/color][color=#007700](); }} class [/color][color=#0000bb]goods[/color][color=#007700]{ public [/color][color=#0000bb]string label[/color][color=#007700], [/color][color=#0000bb]code[/color][color=#007700]; public [/color][color=#0000bb]int quantity[/color][color=#007700]; public [/color][color=#0000bb]int price[/color][color=#007700], [/color][color=#0000bb]time[/color][color=#007700]; public [/color][color=#0000bb]int checkout[/color][color=#007700]([/color][color=#0000bb]int quantity[/color][color=#007700], [/color][color=#0000bb]int price[/color][color=#007700], [/color][color=#0000bb]int time[/color][color=#007700]){ [/color][color=#0000bb]int total[/color][color=#007700]; if ([/color][color=#0000bb]time[/color][color=#007700]>=[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]time[/color][color=#007700]<=[/color][color=#0000bb]17[/color][color=#007700]) { [/color][color=#0000bb]total [/color][color=#007700]= (int) ([/color][color=#0000bb]price[/color][color=#007700]*[/color][color=#0000bb]quantity [/color][color=#007700]- [/color][color=#0000bb]price[/color][color=#007700]*[/color][color=#0000bb]quantity[/color][color=#007700]*[/color][color=#0000bb]0.05[/color][color=#007700]); } else [/color][color=#0000bb]total [/color][color=#007700]= [/color][color=#0000bb]price[/color][color=#007700]*[/color][color=#0000bb]quantity[/color][color=#007700]; return [/color][color=#0000bb]total[/color][color=#007700]; } public [/color][color=#0000bb]void inputgoods[/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]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"enter goods\'s label: "[/color][color=#007700]); [/color][color=#0000bb]label [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]label[/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]"you mustn\'t enter empty value, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]label [/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 goods\'s code: "[/color][color=#007700]); [/color][color=#0000bb]code [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); while ([/color][color=#0000bb]code[/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]"you mustn\'t enter empty value, please enter again!"[/color][color=#007700]); [/color][color=#0000bb]code [/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 quantity of goods: "[/color][color=#007700]); [/color][color=#0000bb]quantity [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]quantity[/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]"please dot not enter quantity less than zero, enter again!"[/color][color=#007700]); [/color][color=#0000bb]quantity [/color][color=#007700]= [/color][color=#0000bb]s[/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]"enter price of goods: "[/color][color=#007700]); [/color][color=#0000bb]price [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]price[/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]"please dot not enter price less than zero, enter again!"[/color][color=#007700]); [/color][color=#0000bb]price [/color][color=#007700]= [/color][color=#0000bb]s[/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]"enter buy time: "[/color][color=#007700]); [/color][color=#0000bb]time [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]time[/color][color=#007700]>[/color][color=#0000bb]24 [/color][color=#007700]|| [/color][color=#0000bb]time[/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]"please enter time from 0h to 24h, enter again!"[/color][color=#007700]); [/color][color=#0000bb]time [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } public [/color][color=#0000bb]void showgoods[/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]"goods\'s label: "[/color][color=#007700]+[/color][color=#0000bb]label[/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]"goods\'s code: "[/color][color=#007700]+[/color][color=#0000bb]code[/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]"goods\'s quantity: "[/color][color=#007700]+[/color][color=#0000bb]quantity[/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]"goods\'s price: "[/color][color=#007700]+[/color][color=#0000bb]price[/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]"goods\'s buy time: "[/color][color=#007700]+[/color][color=#0000bb]time[/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]"total value of goods: "[/color][color=#007700]+[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]checkout[/color][color=#007700]([/color][color=#0000bb]quantity[/color][color=#007700], [/color][color=#0000bb]price[/color][color=#007700], [/color][color=#0000bb]time[/color][color=#007700])); }}[/color]
</div>
</div>
-
11-07-2013, 07:00 AM #17Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
nhờ các bạn xem giúp mình và cho lời nhận xét để mình khắc phục. cảm ơn!
<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 unit14[/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 lớp hàng hóa gồm: tên hàng, mã hàng, giá hàng, số lượng.//nếu mua vào khoảng 8h -> 17h hàng ngày , được giảm giá 5%//tạo phương thức tính tổng tiền.//tạo 1 đối tượng, nhập các giá trị từ màn hình console.//in toàn bộ thông tin đơn hàng ra ngoài màn hình console gồm://tên, mã, giá, số lượng, thời gian mua.[/color][color=#007700]public class [/color][color=#0000bb]hanghoa [/color][color=#007700]{ private [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700]; private [/color][color=#0000bb]int giaban[/color][color=#007700], [/color][color=#0000bb]soluong[/color][color=#007700], [/color][color=#0000bb]thoigian[/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]"
ten hang:"[/color][color=#007700]); [/color][color=#0000bb]tenhang [/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]"
ma hang:"[/color][color=#007700]); [/color][color=#0000bb]mahang [/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]"
gia ban:"[/color][color=#007700]); do { [/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]giaban [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap gia ban >0"[/color][color=#007700]); [/color][color=#0000bb]giaban [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } while ([/color][color=#0000bb]giaban [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
so luong:"[/color][color=#007700]); do { [/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]soluong [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap so luong >0"[/color][color=#007700]); [/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } while ([/color][color=#0000bb]soluong [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
thoi gian mua:"[/color][color=#007700]); do { [/color][color=#0000bb]thoigian [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]thoigian [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]thoigian [/color][color=#007700]> [/color][color=#0000bb]24[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap lai thoi gian:"[/color][color=#007700]); [/color][color=#0000bb]thoigian [/color][color=#007700]= [/color][color=#0000bb]scan[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } while ([/color][color=#0000bb]thoigian [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]thoigian [/color][color=#007700]> [/color][color=#0000bb]24[/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].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"
thong tin don hang:"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
ten:" [/color][color=#007700]+ [/color][color=#0000bb]tenhang [/color][color=#007700]+ [/color][color=#dd0000]"
ma hang:" [/color][color=#007700]+ [/color][color=#0000bb]mahang [/color][color=#007700]+ [/color][color=#dd0000]"
don gia:" [/color][color=#007700]+ [/color][color=#0000bb]giaban[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
so luong:" [/color][color=#007700]+ [/color][color=#0000bb]soluong [/color][color=#007700]+ [/color][color=#dd0000]"
thoi gian mua:" [/color][color=#007700]+ [/color][color=#0000bb]thoigian[/color][color=#007700]); } public [/color][color=#0000bb]int tongtien[/color][color=#007700]() { if ([/color][color=#0000bb]thoigian [/color][color=#007700]>= [/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]thoigian [/color][color=#007700]<= [/color][color=#0000bb]17[/color][color=#007700]) { return (int) ([/color][color=#0000bb]0.95 [/color][color=#007700]* [/color][color=#0000bb]soluong [/color][color=#007700]* [/color][color=#0000bb]giaban[/color][color=#007700]); } else { return (int) [/color][color=#0000bb]soluong [/color][color=#007700]* [/color][color=#0000bb]giaban[/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]hanghoa hh [/color][color=#007700]= new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]nhaptt[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]hientt[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
tong tien:" [/color][color=#007700]+ [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]tongtien[/color][color=#007700]()); }}[/color]
</div>
</div>
-
11-15-2013, 07:00 AM #18Junior Member
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
exception in thread "main" java.lang.nosuchfielderror: lop
at javademoandroidvn.javademo.main(javademo.java:31)
lỗi này là gì vậy ad ơi, mình làm y chang như bài tính dtb với học lực mà k chạy được, hic
-
11-16-2013, 07:00 AM #19Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
Gửi bởi vjrus.ht
-
01-19-2014, 07:00 AM #20Junior Member
- Ngày tham gia
- Jul 2014
- Bài viết
- 0
bai 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]
[/color][color=#007700]public class [/color][color=#0000bb]hanghoa [/color][color=#007700]{ public [/color][color=#0000bb]string tenhang[/color][color=#007700]; public [/color][color=#0000bb]string mahang[/color][color=#007700]; public [/color][color=#0000bb]float giahang[/color][color=#007700]; public [/color][color=#0000bb]int soluong[/color][color=#007700]; public [/color][color=#0000bb]date thoigianmua[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]simpledateformat dinhdangthoigian [/color][color=#007700]= new [/color][color=#0000bb]simpledateformat[/color][color=#007700]([/color][color=#dd0000]"yyyy-mm-dd hh:mm:ss"[/color][color=#007700]); public [/color][color=#0000bb]void nhap[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập mã hàng: "[/color][color=#007700]); [/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập tên hàng: "[/color][color=#007700]); [/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập giá hàng (>0): "[/color][color=#007700]); [/color][color=#0000bb]giahang [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } while ( [/color][color=#0000bb]giahang [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhập số lượng: "[/color][color=#007700]); [/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } while ( [/color][color=#0000bb]soluong [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]); [/color][color=#0000bb]date thoigian [/color][color=#007700]= new [/color][color=#0000bb]date[/color][color=#007700](); [/color][color=#0000bb]thoigianmua [/color][color=#007700]= [/color][color=#0000bb]thoigian[/color][color=#007700]; } public [/color][color=#0000bb]void xuatmanhinh[/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 hàng hóa đã mua"[/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]"mã hàng: " [/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]"tên hàng: " [/color][color=#007700]+ [/color][color=#0000bb]tenhang[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"giá hàng: " [/color][color=#007700]+ [/color][color=#0000bb]giahang[/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]"số lượng: " [/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]tongtien[/color][color=#007700]([/color][color=#0000bb]giahang[/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]"thời gian mua: " [/color][color=#007700]+ [/color][color=#0000bb]dinhdangthoigian[/color][color=#007700].[/color][color=#0000bb]format[/color][color=#007700]([/color][color=#0000bb]thoigianmua[/color][color=#007700].[/color][color=#0000bb]gettime[/color][color=#007700]())); } public [/color][color=#0000bb]float tongtien[/color][color=#007700]([/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]int soluong[/color][color=#007700]){ [/color][color=#0000bb]float giagiam [/color][color=#007700]= [/color][color=#0000bb]giahang[/color][color=#007700]; if ([/color][color=#0000bb]thoigianmua[/color][color=#007700].[/color][color=#0000bb]gethours[/color][color=#007700]() >= [/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]thoigianmua[/color][color=#007700].[/color][color=#0000bb]gethours[/color][color=#007700]() <= [/color][color=#0000bb]17[/color][color=#007700]) [/color][color=#0000bb]giagiam [/color][color=#007700]= (float) ([/color][color=#0000bb]giahang [/color][color=#007700]- [/color][color=#0000bb]giahang[/color][color=#007700]*[/color][color=#0000bb]0.05[/color][color=#007700]); return ([/color][color=#0000bb]giagiam [/color][color=#007700]* [/color][color=#0000bb]soluong[/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]hanghoa hh [/color][color=#007700]= new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700](); [/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]xuatmanhinh[/color][color=#007700](); }[/color]
</div>
</div>
Một trong những điểm mạnh của Công ty TNHH SX TM Thép Đông Anh chính là sự linh hoạt trong việc đáp ứng nhu cầu đa dạng của khách hàng. Chúng tôi hiểu rằng mỗi công trình xây dựng đều có những yêu...
Lưới thép hàn Đông Anh - Được các nhà thầu tin cậy và lựa chọn