Trang 3 của 4 Đầu tiênĐầu tiên 1234 CuốiCuối
Kết quả 21 đến 30 của 37
  1. #21
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    Mã nguồn HTML:
    
    
    khi mình chạy thì báo lỗi :
    exception in thread "main" java.lang.unsupportedoperationexception: not supported yet.
    at javabasic.hocsinh.getname(hocsinh.java:59)
    at javabasic.quanli.main(quanli.java:51)
    java result: 1
    bạn giúp mình với,thank bạn!!!

  2. #22
    Ngày tham gia
    Feb 2015
    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ã:
    import java.util.date;
    import java.util.scanner;
    public class bai1 {
     
        public static void main(string[] args) {
            hanghoa hh = new hanghoa();
            system.out.println("nhap ten hang hoa: ");
            hh.tenhang = input.nhapten();
            system.out.println("nhap ma hang hoa: ");
            hh.mahang = input.nhapten();
            system.out.println("nhap gia: ");
            hh.giahang = input.nhapso();
            system.out.println("nhap so luong: ");
            hh.soluong = input.nhapso();
            system.out.println();
           
    //        in bill
            system.out.println("hóa đơn");
            system.out.println("tên hàng: "+hh.tenhang);
            system.out.println("mã hàng: "+hh.mahang);
            system.out.println("giá: "+hh.giahang+" vnđ");
            system.out.println("số lượng: "+hh.soluong);
            double tien = hh.tongtien();
            system.out.println("thanh tien: " + tien);
            system.out.println("thank you bought!");
     
        }
    }
     
    class hanghoa {
     
        string tenhang, mahang;
        float giahang, soluong;
     
        public double tongtien() {
            float tien = giahang * soluong;
            date date = new date();
            int h = date.gethours();
           
            if (h > 8 && h < 17) {
                system.out.println("giảm gia: 5%");
                return tien * (1 - 0.05);
            } else {
                system.out.println("giảm giá: 0");
                return tien;
            }
        }
    }
     
    class input {
     
        public static float nhapso() {
            float n = 0;
            scanner input = new scanner(system.in);
            boolean check = true;
            while (check) {
                try {
                    n = input.nextfloat();
                    if (n < 0) {
                        system.out.println("gia tri nhap phai > 0, nhap lai!");
                        continue;
                    } else {
                        check = false;
                    }
                } catch (exception e) {
                    system.out.println("chi duoc nhap so, nhap lai!");
                    input.nextline();
                }
            }
            return n;
        }
     
        public static string nhapten() {
            scanner input = new scanner(system.in);
            return input.nextline();
        }
    }
    </blockquote></div>
    </div>
    </div>

  3. #23
    Ngày tham gia
    May 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]
    package javabasic[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];class [/color][color=#0000bb]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]float time[/color][color=#007700]; public [/color][color=#0000bb]void danhsachmathang[/color][color=#007700](){ [/color][color=#0000bb]hanghoa h1[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hanghoa h2[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hanghoa h3[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]hanghoa h4[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/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]"+danh sach mat hang:"[/color][color=#007700]); [/color][color=#0000bb]h1[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]=[/color][color=#dd0000]"kem danh rang"[/color][color=#007700]; [/color][color=#0000bb]h1[/color][color=#007700].[/color][color=#0000bb]mahang[/color][color=#007700]=[/color][color=#dd0000]"kdr123"[/color][color=#007700]; [/color][color=#0000bb]h1[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700]=[/color][color=#0000bb]23000[/color][color=#007700]; [/color][color=#0000bb]h1[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]=[/color][color=#0000bb]20[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]h1[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]); [/color][color=#0000bb]h2[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]=[/color][color=#dd0000]"banh my"[/color][color=#007700]; [/color][color=#0000bb]h2[/color][color=#007700].[/color][color=#0000bb]mahang[/color][color=#007700]=[/color][color=#dd0000]"mb123"[/color][color=#007700]; [/color][color=#0000bb]h2[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700]=[/color][color=#0000bb]5000[/color][color=#007700]; [/color][color=#0000bb]h2[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]=[/color][color=#0000bb]15[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]h2[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]); [/color][color=#0000bb]h3[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]=[/color][color=#dd0000]"my tom"[/color][color=#007700]; [/color][color=#0000bb]h3[/color][color=#007700].[/color][color=#0000bb]mahang[/color][color=#007700]=[/color][color=#dd0000]"mt123"[/color][color=#007700]; [/color][color=#0000bb]h3[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700]=[/color][color=#0000bb]4500[/color][color=#007700]; [/color][color=#0000bb]h3[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]=[/color][color=#0000bb]50[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]h3[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]); [/color][color=#0000bb]h4[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]=[/color][color=#dd0000]"giay ve sinh"[/color][color=#007700]; [/color][color=#0000bb]h4[/color][color=#007700].[/color][color=#0000bb]mahang[/color][color=#007700]=[/color][color=#dd0000]"gvs123"[/color][color=#007700]; [/color][color=#0000bb]h4[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700]=[/color][color=#0000bb]10000[/color][color=#007700]; [/color][color=#0000bb]h4[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]=[/color][color=#0000bb]30[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]+[/color][color=#0000bb]h4[/color][color=#007700].[/color][color=#0000bb]tenhang[/color][color=#007700]); } public [/color][color=#0000bb]float tinhtien1[/color][color=#007700]([/color][color=#0000bb]float gh[/color][color=#007700],[/color][color=#0000bb]int sl[/color][color=#007700]){ return [/color][color=#0000bb]gh[/color][color=#007700]*[/color][color=#0000bb]sl[/color][color=#007700]; } public [/color][color=#0000bb]float tinhtien2[/color][color=#007700]([/color][color=#0000bb]float gh[/color][color=#007700],[/color][color=#0000bb]int sl[/color][color=#007700]){ return (float)([/color][color=#0000bb]gh[/color][color=#007700]*[/color][color=#0000bb]sl[/color][color=#007700]*[/color][color=#0000bb]0.95[/color][color=#007700]); } public [/color][color=#0000bb]void donhang[/color][color=#007700]([/color][color=#0000bb]string st[/color][color=#007700],[/color][color=#0000bb]float g[/color][color=#007700],[/color][color=#0000bb]float t[/color][color=#007700]){ [/color][color=#0000bb]hanghoa a[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/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]st[/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:"[/color][color=#007700]+[/color][color=#0000bb]g[/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]" thanh tien:"[/color][color=#007700]+[/color][color=#0000bb]t[/color][color=#007700]); } public static [/color][color=#0000bb]void nhap[/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]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"+mat hang ma ban muon mua:"[/color][color=#007700]); [/color][color=#0000bb]string stt[/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].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"+so luong:"[/color][color=#007700]); [/color][color=#0000bb]int sll[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"+time:"[/color][color=#007700]); [/color][color=#0000bb]int time[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#0000bb]hanghoa a[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); if([/color][color=#0000bb]stt[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"kem danh rang"[/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]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"kdr123"[/color][color=#007700],[/color][color=#0000bb]23000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]23000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); else [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"kdr123"[/color][color=#007700],[/color][color=#0000bb]23000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]23000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); } if([/color][color=#0000bb]stt[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"banh my"[/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]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"bm123"[/color][color=#007700],[/color][color=#0000bb]5000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]5000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); else [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"kdr123"[/color][color=#007700],[/color][color=#0000bb]5000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]5000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); } if([/color][color=#0000bb]stt[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"my tom"[/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]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"mt123"[/color][color=#007700],[/color][color=#0000bb]4500[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]4500[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); else [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"mt123"[/color][color=#007700],[/color][color=#0000bb]4500[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]4500[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); } if([/color][color=#0000bb]stt[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"giay ve sinh"[/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]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"gvs123"[/color][color=#007700],[/color][color=#0000bb]10000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]10000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); else [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"gvs123"[/color][color=#007700],[/color][color=#0000bb]10000[/color][color=#007700],[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tinhtien2[/color][color=#007700]([/color][color=#0000bb]10000[/color][color=#007700], [/color][color=#0000bb]sll[/color][color=#007700])); } }}public class [/color][color=#0000bb]classhanghoa [/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 a[/color][color=#007700]=new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]danhsachmathang[/color][color=#007700](); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]nhap[/color][color=#007700](); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  4. #24
    Ngày tham gia
    Sep 2014
    Bài viết
    0
    mong mọi người chỉ bảo thêm !
    <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ã:
    /*
    * to change this license header, choose license headers in project properties.
    * to change this template file, choose tools | templates
    * and open the template in the editor.
    */
     
    package exam14;
     
    import java.text.dateformat;
    import java.text.simpledateformat;
    import java.util.date;
    import java.util.scanner;
     
    /**
    *
    * @author le
    */
    class hoadon {
        public string namegoods;
        public string idgoods;
        public int pricegoods;
        public int number;
        public int totalmoney(float time){
            int total = 0;
            if(time >=8||time <= 17){
                total = (pricegoods*number - pricegoods*number*5/100);
            }
            if(time <8||time>17){
                total =  pricegoods*number;
            }
            return total;
        }
        public void input(){
            scanner input = new scanner(system.in);
            system.out.print(" + namegoods:");
            namegoods = input.nextline();
            system.out.print(" + idgoods:");
            idgoods = input.nextline();
            system.out.print(" + pricegoods:");
            pricegoods = input.nextint();
            system.out.println(" + numbersgoods:");
            number = input.nextint();
        }
        public void show(){
            date date = new date();
            system.out.println(" + name goods :"+namegoods);
            system.out.println(" + id goods: "+idgoods);
            system.out.println(" + price goods: "+pricegoods);
            system.out.println(" + number goods: "+number);
            system.out.println(" + total money: "+totalmoney(date.gethours()));
            dateformat dateformat = new simpledateformat("hh:mm:ss dd/mm/yyyy");
            string hienthingayban = dateformat.format(date);
            system.out.println(" + date sell: "+date);
        }         
    }
    public class goodsmanager{
        public static void main(string[] args){
            hoadon a = new hoadon();
            system.out.println(" *** nhap thong tin hang vua ban ***");
            a.input();
            system.out.println(" *** hien thi thong tin don hang ***");
            a.show();
        }
    }
    </blockquote></div>
    </div>
    </div>

  5. #25
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    ủa mọi người ! đề bài đâu có biến thời gian mua ! o_o

  6. #26
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    em nộp bài, nhờ mọi người xem và góp ý với cách làm của em


    Mã:
    class hh{
        public string tenhang, mahang;
        public int soluong, dongia,time;
        public double tinhtt(){
            double tt=0.0;
            if((time >= 8)&&(time <= 17)) tt = soluong*dongia*0.95;
            else tt= soluong*dongia;
            return tt;
        }
        public void nhaptt(){
            scanner input = new scanner(system.in);
            system.out.println("nhap du lieu:");
            system.out.println("nhap ma hang:");
            mahang = input.nextline();
            system.out.println("nhap ten hang:");
            tenhang = input.nextline();
            system.out.println("nhap so luong:");
            soluong = input.nextint();
            system.out.println("nhap don gia:");
            dongia = input.nextint();
            do{
            system.out.println("nhap thoi gian mua hang tu 0 den 24:");
            time = input.nextint();
            }while(time<0&&time>24);
        }
        public void intt(){
            system.out.println("thong tin mua hang:");
            system.out.println("ma hang:"+mahang);
            system.out.println("ten hang:"+tenhang);
            system.out.println("so luong:"+soluong);
            system.out.println("don gia:"+dongia);
            system.out.println("thoi gian mua hang:"+time);
        }
    }
    public class bai1 {
        public static void main(string[] args) {
            hh hd1 = new hh();
            hd1.nhaptt();
            hd1.intt();
            system.out.println("tong so tien khach phai tra:"+hd1.tinhtt());
        }
     
    }

  7. #27
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>

    Mã nguồn PHP:
    [color=#000000]
    package main[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];class [/color][color=#0000bb]hanghoa[/color][color=#007700]{public [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700];public [/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]time[/color][color=#007700], [/color][color=#0000bb]tongtien[/color][color=#007700];public [/color][color=#0000bb]int soluong[/color][color=#007700];public [/color][color=#0000bb]void tinhs[/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]giahang [/color][color=#007700]=([/color][color=#0000bb]giahang[/color][color=#007700]*[/color][color=#0000bb]95[/color][color=#007700]/[/color][color=#0000bb]100[/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]"tong tien thanh toan: "[/color][color=#007700]+[/color][color=#0000bb]tongtien[/color][color=#007700]);}public [/color][color=#0000bb]void hoadon[/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]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]tenhang [/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].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ma hang: "[/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].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"gia hang: "[/color][color=#007700]);[/color][color=#0000bb]giahang [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextfloat[/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]"thoi gian: "[/color][color=#007700]);[/color][color=#0000bb]time [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextfloat[/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]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();}public [/color][color=#0000bb]void showhoadon[/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 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]"ten hang: "[/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]"ma hang: "[/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 hang: "[/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]"thoi gian: "[/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]"so luong: "[/color][color=#007700]+[/color][color=#0000bb]soluong[/color][color=#007700]);}}public class [/color][color=#0000bb]goods [/color][color=#007700]{public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]agrs[/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]hoadon[/color][color=#007700]();[/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]showhoadon[/color][color=#007700]();[/color][color=#0000bb]hh[/color][color=#007700].[/color][color=#0000bb]tinhs[/color][color=#007700](); } }[/color] 
    </blockquote></div>
    </div>
    </div>

  8. #28
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    xem giup minh voi nha
    <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 quanlibanhang[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];class [/color][color=#0000bb]hanghoa[/color][color=#007700]{ public [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700]; public [/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]soluong[/color][color=#007700], [/color][color=#0000bb]thoigian[/color][color=#007700]; public [/color][color=#0000bb]float giamgia[/color][color=#007700]([/color][color=#0000bb]float thoigian[/color][color=#007700], [/color][color=#0000bb]float giahang[/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 (float) ([/color][color=#0000bb]giahang [/color][color=#007700]* [/color][color=#0000bb]95 [/color][color=#007700]/ [/color][color=#0000bb]100[/color][color=#007700]); } return (float) ([/color][color=#0000bb]giahang[/color][color=#007700]); } public [/color][color=#0000bb]float tongtien[/color][color=#007700]([/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]float soluong[/color][color=#007700]){ return ([/color][color=#0000bb]giahang [/color][color=#007700]* [/color][color=#0000bb]soluong[/color][color=#007700]); } } public class [/color][color=#0000bb]quanlibanhang [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]hanghoa a [/color][color=#007700]= new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ten hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ma hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap gia ban (nghin dong): "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giahang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so luong: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thoi gian ban hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thong tin:"[/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]a[/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]"ma hang: " [/color][color=#007700]+ [/color][color=#0000bb]a[/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]a[/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]"so luong: " [/color][color=#007700]+ [/color][color=#0000bb]a[/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]"thoi gian mua: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian [/color][color=#007700]+ [/color][color=#dd0000]"gio"[/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 ban hang: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tongtien[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giamgia[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700], [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian[/color][color=#007700]), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]) + [/color][color=#dd0000]"nghin dong"[/color][color=#007700]); } }[/color] 
    </blockquote></div>
    </div>
    </div>

  9. #29
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    Trích dẫn Gửi bởi caoboi_92
    bạn ơi sao mình không in ra được tổng tiền lúc không giảm giá được vậy, cứ lệch ra 8h với 17h là nó in ra đơn giá chứ không có in ra tổng tiền .
    @caoboi_92 : bài đúng mà bạn mình thấy in bình thường mà

  10. #30
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    Trích dẫn Gửi bởi hell3880
    xem giup minh voi nha
    <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 quanlibanhang[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];class [/color][color=#0000bb]hanghoa[/color][color=#007700]{ public [/color][color=#0000bb]string tenhang[/color][color=#007700], [/color][color=#0000bb]mahang[/color][color=#007700]; public [/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]soluong[/color][color=#007700], [/color][color=#0000bb]thoigian[/color][color=#007700]; public [/color][color=#0000bb]float giamgia[/color][color=#007700]([/color][color=#0000bb]float thoigian[/color][color=#007700], [/color][color=#0000bb]float giahang[/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 (float) ([/color][color=#0000bb]giahang [/color][color=#007700]* [/color][color=#0000bb]95 [/color][color=#007700]/ [/color][color=#0000bb]100[/color][color=#007700]); } return (float) ([/color][color=#0000bb]giahang[/color][color=#007700]); } public [/color][color=#0000bb]float tongtien[/color][color=#007700]([/color][color=#0000bb]float giahang[/color][color=#007700], [/color][color=#0000bb]float soluong[/color][color=#007700]){ return ([/color][color=#0000bb]giahang [/color][color=#007700]* [/color][color=#0000bb]soluong[/color][color=#007700]); } } public class [/color][color=#0000bb]quanlibanhang [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]scanner nhap [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]hanghoa a [/color][color=#007700]= new [/color][color=#0000bb]hanghoa[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ten hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tenhang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ma hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]mahang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap gia ban (nghin dong): "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giahang [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so luong: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]soluong [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap thoi gian ban hang: "[/color][color=#007700]); [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian [/color][color=#007700]= [/color][color=#0000bb]nhap[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thong tin:"[/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]a[/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]"ma hang: " [/color][color=#007700]+ [/color][color=#0000bb]a[/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]a[/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]"so luong: " [/color][color=#007700]+ [/color][color=#0000bb]a[/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]"thoi gian mua: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian [/color][color=#007700]+ [/color][color=#dd0000]"gio"[/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 ban hang: " [/color][color=#007700]+ [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]tongtien[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giamgia[/color][color=#007700]([/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]giahang[/color][color=#007700], [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]thoigian[/color][color=#007700]), [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]soluong[/color][color=#007700]) + [/color][color=#dd0000]"nghin dong"[/color][color=#007700]); } }[/color] 
    </blockquote></div>
    </div>
    </div>
    @hell3380: bạn xem lại dòng cuối cùng của hàm main nhé, bạn sai vị trí của 2 thông số trong phương thức giảm giá rùi

Trang 3 của 4 Đầu tiênĐầu tiên 1234 CuốiCuối

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •