Trang 3 của 4 Đầu tiênĐầu tiên 1234 CuốiCuối
Kết quả 21 đến 30 của 40
  1. #21
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    bài của mình này, càng ngày càng hiểu được thêm một chút, ko biết các bài sau có khó không.
    <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]bai19[/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]bill billwithoutdiscount [/color][color=#007700]= new [/color][color=#0000bb]bill[/color][color=#007700]([/color][color=#dd0000]"noodle"[/color][color=#007700], [/color][color=#dd0000]"omachi"[/color][color=#007700], [/color][color=#0000bb]6000[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700]); [/color][color=#0000bb]bill billafterdiscount [/color][color=#007700]= new [/color][color=#0000bb]bill[/color][color=#007700]([/color][color=#dd0000]"noodle"[/color][color=#007700], [/color][color=#dd0000]"omachi"[/color][color=#007700], [/color][color=#0000bb]6000[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700], [/color][color=#0000bb]5[/color][color=#007700]); } } class [/color][color=#0000bb]bill [/color][color=#007700]{ private [/color][color=#0000bb]string productname[/color][color=#007700]; private [/color][color=#0000bb]string productcode[/color][color=#007700]; private [/color][color=#0000bb]int productprice[/color][color=#007700]; private [/color][color=#0000bb]int productquantity[/color][color=#007700]; private [/color][color=#0000bb]int productdiscount[/color][color=#007700]; public [/color][color=#0000bb]bill[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]string code[/color][color=#007700], [/color][color=#0000bb]int price[/color][color=#007700], [/color][color=#0000bb]int quantity[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productname [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productcode [/color][color=#007700]= [/color][color=#0000bb]code[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productprice [/color][color=#007700]= [/color][color=#0000bb]price[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productquantity [/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]"total of money you have to pay for " [/color][color=#007700]+ [/color][color=#0000bb]quantity [/color][color=#007700]+ [/color][color=#dd0000]" units " [/color][color=#007700]+ [/color][color=#0000bb]code [/color][color=#007700]+ [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]name [/color][color=#007700]+ [/color][color=#dd0000]" with price " [/color][color=#007700]+ [/color][color=#0000bb]price [/color][color=#007700]+ [/color][color=#dd0000]" vnd per unit " [/color][color=#007700]+ [/color][color=#dd0000]" is: " [/color][color=#007700]+ ([/color][color=#0000bb]quantity [/color][color=#007700]* [/color][color=#0000bb]price[/color][color=#007700]) + [/color][color=#dd0000]" vnd."[/color][color=#007700]); } public [/color][color=#0000bb]bill[/color][color=#007700]([/color][color=#0000bb]string name[/color][color=#007700], [/color][color=#0000bb]string code[/color][color=#007700], [/color][color=#0000bb]int price[/color][color=#007700], [/color][color=#0000bb]int quantity[/color][color=#007700], [/color][color=#0000bb]int discount[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productname [/color][color=#007700]= [/color][color=#0000bb]name[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productcode [/color][color=#007700]= [/color][color=#0000bb]code[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productprice [/color][color=#007700]= [/color][color=#0000bb]price[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productquantity [/color][color=#007700]= [/color][color=#0000bb]quantity[/color][color=#007700]; [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]productdiscount [/color][color=#007700]= [/color][color=#0000bb]discount[/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 of money you have to pay for " [/color][color=#007700]+ [/color][color=#0000bb]quantity [/color][color=#007700]+ [/color][color=#dd0000]" units " [/color][color=#007700]+ [/color][color=#0000bb]code [/color][color=#007700]+ [/color][color=#dd0000]" " [/color][color=#007700]+ [/color][color=#0000bb]name [/color][color=#007700]+ [/color][color=#dd0000]" with price " [/color][color=#007700]+ [/color][color=#0000bb]price [/color][color=#007700]+ [/color][color=#dd0000]" vnd per unit " [/color][color=#007700]+ [/color][color=#dd0000]" after promotion is: " [/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]price [/color][color=#007700]* [/color][color=#0000bb]discount [/color][color=#007700]/ [/color][color=#0000bb]100[/color][color=#007700])) + [/color][color=#dd0000]" vnd. :d"[/color][color=#007700]); } }[/color] 
    </blockquote></div>
    </div>
    </div>

  2. #22
    Ngày tham gia
    Apr 2015
    Bài viết
    9
    Mã:
    /*
    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
    */
     
    package constractor;
     
    class donhang{
        private final string tenhang;
        private final string mahang;
        private final int giaban;
        private final int soluong;
        private int phantramgiamgia;
        private final float tongtien;
       
       
        public donhang(string th, string mh, int g, int sl){
            this.tenhang=th;
            this.mahang=mh;
            this.giaban=g;
            this.soluong=sl;
            this.tongtien=sl*g;
            system.out.println("
    ten hang: "+this.tenhang+ "
    ma hang: "+this.mahang+"
    gia: "+this.giaban+"
    so luong: "+this.soluong+"
    tong tien: "+this.tongtien);
        }
        public donhang(string th, string mh, int g, int sl, int pt){
            this.tenhang= th;
            this.mahang=mh;
            this.giaban=g;
            this.soluong=sl;
            this.phantramgiamgia=pt;
            this.tongtien=(float) (sl*g-sl*g*pt/100);
     
            system.out.println("ten hang: "+this.tenhang+ "
    ma hang: "+this.mahang+"
    gia: "+this.giaban+"
    so luong: "+this.soluong+"
    phan tram giam gia: "+this.phantramgiamgia+"
    tong tien: "+this.tongtien);
        }
    }
     
    public class maincontractor {
        public static void main(string []args){
            donhang d1= new donhang("may tinh","123t", 100, 2);
            system.out.println("");
            donhang d2= new donhang("may tinh","123t", 100, 2, 20);
           
        }
    }

  3. #23
    Ngày tham gia
    Apr 2014
    Bài viết
    0
    Mã:
    /*
    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
    */
     
    package constractor;
     
    class donhang{
        private final string tenhang;
        private final string mahang;
        private final int giaban;
        private final int soluong;
        private int phantramgiamgia;
        private final float tongtien;
       
       
        public donhang(string th, string mh, int g, int sl){
            this.tenhang=th;
            this.mahang=mh;
            this.giaban=g;
            this.soluong=sl;
            this.tongtien=sl*g;
            system.out.println("
    ten hang: "+this.tenhang+ "
    ma hang: "+this.mahang+"
    gia: "+this.giaban+"
    so luong: "+this.soluong+"
    tong tien: "+this.tongtien);
        }
        public donhang(string th, string mh, int g, int sl, int pt){
            this.tenhang= th;
            this.mahang=mh;
            this.giaban=g;
            this.soluong=sl;
            this.phantramgiamgia=pt;
            this.tongtien=(float) (sl*g-sl*g*pt/100);
     
            system.out.println("ten hang: "+this.tenhang+ "
    ma hang: "+this.mahang+"
    gia: "+this.giaban+"
    so luong: "+this.soluong+"
    phan tram giam gia: "+this.phantramgiamgia+"
    tong tien: "+this.tongtien);
        }
    }
     
    public class maincontractor {
        public static void main(string []args){
            donhang d1= new donhang("may tinh","123t", 100, 2);
            system.out.println("");
            donhang d2= new donhang("may tinh","123t", 100, 2, 20);
           
        }
    }

  4. #24
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    123

  5. #25
    Ngày tham gia
    Jan 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ã:
    /*
        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).
    */
    package demo_constructor;
     
    class donhang
    {
        private string donhang;
        private string mahang;
        private long giaban;
        private int soluong;
        private int tilegiamgia;
       
        public donhang(string donhang,string mahang,long giaban,int soluong)
        {
            this.donhang = donhang;
            this.giaban = giaban;
            this.mahang = mahang;
            this.soluong = soluong;
           
            system.out.println("tổng tiền: "+(giaban*soluong));
        }
       
        public donhang(string donhang,string mahang,long giaban,int soluong, int tilegiamgia)
        {
            this.donhang = donhang;
            this.giaban = giaban;
            this.mahang = mahang;
            this.soluong = soluong;
            this.tilegiamgia = tilegiamgia;
           
            system.out.println("tổng tiền: "+(giaban*soluong-(giaban*soluong*tilegiamgia/100)));
        }
    }
     
    public class bai_tap {
        public static void main(string[] args) {
            donhang bh1 = new donhang("ok","123",20000,2);
            donhang bh2 = new donhang("ok","123",20000,2,10);
        }
    }
    </blockquote></div>
    </div>
    </div>

  6. #26
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    đơn hàng:
    <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]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 tilegiam[/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 gettilegiam[/color][color=#007700]() { return [/color][color=#0000bb]tilegiam[/color][color=#007700]; } public [/color][color=#0000bb]void settilegiam[/color][color=#007700]([/color][color=#0000bb]float tilegiam[/color][color=#007700]) { [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tilegiam [/color][color=#007700]= [/color][color=#0000bb]tilegiam[/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]"ten hang: " [/color][color=#007700]+ [/color][color=#0000bb]this[/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]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]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]"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: " [/color][color=#007700]+ (float) ([/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 tilegiam[/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]tilegiam [/color][color=#007700]= [/color][color=#0000bb]tilegiam[/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]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]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]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]"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]"ti le giam: " [/color][color=#007700]+ [/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tilegiam[/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]+ (float) ([/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]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]this[/color][color=#007700].[/color][color=#0000bb]tilegiam[/color][color=#007700]))); }}[/color] 
    </blockquote></div>
    </div>
    </div>

    main
    <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 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 dh [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"usb"[/color][color=#007700], [/color][color=#dd0000]"usb"[/color][color=#007700],[/color][color=#0000bb]10[/color][color=#007700],[/color][color=#0000bb]10[/color][color=#007700]); [/color][color=#0000bb]donhang dh2 [/color][color=#007700]= new [/color][color=#0000bb]donhang[/color][color=#007700]([/color][color=#dd0000]"mouse"[/color][color=#007700], [/color][color=#dd0000]"mouse"[/color][color=#007700], [/color][color=#0000bb]10[/color][color=#007700],[/color][color=#0000bb]10[/color][color=#007700],[/color][color=#0000bb]0.5f[/color][color=#007700]); }[/color] 
    </blockquote></div>
    </div>
    </div>

  7. #27
    Ngày tham gia
    Mar 2014
    Bài viết
    0
    mn gop ý dùm đi
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>

    show spoiler
    hide spoiler

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


    Mã:
    public class hanghoa {
        string tenhang, mahang;
        int gia,soluong;
        float phantramgiamgia;
     
        public hanghoa(string tenhang, string mahang, int gia, int soluong) {
            this.tenhang = tenhang;
            this.mahang = mahang;
            this.gia = gia;
            this.soluong = soluong;
            system.out.println("tên hàng: "+tenhang+" mã hàng: "+mahang+" gia: "+gia+" số lượng: "+soluong);
            system.out.println("tổng tiền: "+gia*soluong);
        }
     
        public hanghoa(string tenhang, string mahang, int gia, int soluong, float phantramgiamgia) {
            this.tenhang = tenhang;
            this.mahang = mahang;
            this.gia = gia;
            this.soluong = soluong;
            this.phantramgiamgia = phantramgiamgia;
            system.out.println("tên hàng: "+tenhang+"
    mã hàng: "+mahang+"
    gia: "+gia+"
    số lượng: "+soluong);
            system.out.println("tổng tiền: "+gia*soluong*phantramgiamgia);
        }
     
    }
    </blockquote></div>
    </div>
    </div>

  8. #28
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    Trích dẫn Gửi bởi tiasangmoi92
    uh, cứ từ từ, cho anh còn kịp viết bài chứ :v
    bạn học at7 à. code giỏi vậy. mình học at6b nhưng bây giờ mới bắt đầu học code, mang sách bút xuống hỏi vậy :v

  9. #29
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    mong mọi người chỉ bảo thêm :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ã:
    /*
    * 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 exam19;
     
    class order {
     
        private string nameorder;
        private string idorder;
        private int priceorder;
        private int numbers;
        private int saleof;
     
        public order(string name, string id, int price, int number) {
            this.nameorder = name;
            this.idorder = id;
            this.priceorder = price;
            this.numbers = number;
            system.out.println("\tname: " + nameorder + "
    \tid: " + idorder + "
    \tprice: " + priceorder + "
    \tnumbers: " + numbers + "
    \ttotal money: " + (priceorder * numbers));
        }
     
        public order(string name1, string id1, int price1, int number1, int sale) {
            this.nameorder = name1;
            this.idorder = id1;
            this.priceorder = price1;
            this.numbers = number1;
            this.saleof = sale;
            system.out.println("\tname: " + nameorder + "
    \tid: " + idorder + "
    \tprice: " + priceorder + "
    \tnumbers: " + numbers + "
    \ttotal money: " + (priceorder * numbers - priceorder * numbers * saleof / 100));
        }
    }
     
    public class constructor {
     
        public static void main(string[] args) {
            system.out.println("- order 1:");
            order customer = new order("smartphone", "113", 10000000, 2);
            system.out.println("- order 2:");
            order customer1 = new order("laptop", "114", 9500000, 1, 5);
        }
    }
    </blockquote></div>
    </div>
    </div>

  10. #30
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    mọi người xem giúp em bài này với. xem làm thế này đã ổn chưa


    Mã:
    public class donhang {
        private string mahang, tenhang;
        private int gia, sl, pt_giam;
     
        public string getmahang() {
            return mahang;
        }
     
        public string gettenhang() {
            return tenhang;
        }
     
        public int getgia() {
            return gia;
        }
     
        public int getsl() {
            return sl;
        }
     
        public int getpt_giam() {
            return pt_giam;
        }
     
        public void setmahang(string mahang) {
            this.mahang = mahang;
        }
     
        public void settenhang(string tenhang) {
            this.tenhang = tenhang;
        }
     
        public void setgia(int gia) {
            this.gia = gia;
        }
     
        public void setsl(int sl) {
            this.sl = sl;
        }
     
        public void setpt_giam(int pt_giam) {
            this.pt_giam = pt_giam;
        }
        public void donhang(){}
        public void donhang(string mah, string tenh, int gia, int sl){
            this.mahang = mah;
            this.tenhang = tenh;
            this.gia = gia;
            this.sl = sl;
            system.out.println("tong tien:"+ this.gia*this.sl);
        }
        public void donhang(string mah, string tenh, int gia, int sl, int ptgiam){
            this.mahang = mah;
            this.tenhang = tenh;
            this.gia = gia;
            this.sl = sl;
            this.pt_giam = ptgiam;
            system.out.println("tong tien:"+(this.gia*this.sl*(100-this.pt_giam))/100);
        }
        public void ininfor(){
            scanner input = new scanner(system.in);
            system.out.println("nhap ma hang:");
            setmahang(input.nextline());
            system.out.println("nhap ten hang:");
            settenhang(input.nextline());
            system.out.println("nhap gia:");
            setgia(input.nextint());
            system.out.println("nhap so luong:");
            setsl(input.nextint());
            system.out.println("nhap phan tram giam gia:");
            setpt_giam(input.nextint());
        }
        public static void main(string[] args) {
            donhang dh1 = new donhang();
            donhang dh2 = new donhang();
            system.out.println("nhap thong tin cho don hang khong duoc giam gia:");
            dh1.ininfor();
            dh1.donhang(dh1.getmahang(), dh1.gettenhang(), dh1.getgia(), dh1.getsl());
            system.out.println("nhap thong tin cho don hang duoc giam gia:");
            dh2.ininfor();
            dh2.donhang(dh2.getmahang(), dh2.gettenhang(), dh2.getgia(), dh2.getsl(), dh2.getpt_giam());
        }
    }

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
  •