Trang 5 của 5 Đầu tiênĐầu tiên ... 345
Kết quả 41 đến 47 của 47
  1. #41
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>unit16 (move your mouse to reveal the content)</noscript>

    unit16 (open)
    unit16 (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package unit16[/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]unit16 [/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=#ff8000]// input thong tin[/color][color=#0000bb]giangvien gv [/color][color=#007700]= new [/color][color=#0000bb]giangvien[/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]"nhap thong tin giang vien: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ho ten: "[/color][color=#007700]);[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]sethoten[/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]"nam sinh: "[/color][color=#007700]);[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setnamsinh[/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].print([/color][color=#dd0000]"ma the: "[/color][color=#007700]);[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setmathe[/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].print([/color][color=#dd0000]"tien luong hang thang: "[/color][color=#007700]);[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]setluonghangthang[/color][color=#007700]([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextlong[/color][color=#007700]());[/color][color=#ff8000]// show thong tin[/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 giang vien: "[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]gethoten[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getnamsinh[/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 the: " [/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getmathe[/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]"tien luong hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]getluonghangthang[/color][color=#007700]());}} class [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]string hoten[/color][color=#007700];private [/color][color=#0000bb]int namsinh[/color][color=#007700];private [/color][color=#0000bb]int mathe[/color][color=#007700]; public [/color][color=#0000bb]string gethoten[/color][color=#007700]() {return [/color][color=#0000bb]hoten[/color][color=#007700];} public [/color][color=#0000bb]void sethoten[/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700];} public [/color][color=#0000bb]int getnamsinh[/color][color=#007700]() {return [/color][color=#0000bb]namsinh[/color][color=#007700];} public [/color][color=#0000bb]void setnamsinh[/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700];} public [/color][color=#0000bb]int getmathe[/color][color=#007700]() {return [/color][color=#0000bb]mathe[/color][color=#007700];} public [/color][color=#0000bb]void setmathe[/color][color=#007700]([/color][color=#0000bb]int mathe[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]mathe[/color][color=#007700];}} class [/color][color=#0000bb]sinhvien [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]long tienhocphi[/color][color=#007700]; public [/color][color=#0000bb]long gettienhocphi[/color][color=#007700]() {return [/color][color=#0000bb]tienhocphi[/color][color=#007700];} public [/color][color=#0000bb]void settienhocphi[/color][color=#007700]([/color][color=#0000bb]long tienhocphi[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tienhocphi [/color][color=#007700]= [/color][color=#0000bb]tienhocphi[/color][color=#007700];}} class [/color][color=#0000bb]giangvien [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]long luonghangthang[/color][color=#007700]; public [/color][color=#0000bb]long getluonghangthang[/color][color=#007700]() {return [/color][color=#0000bb]luonghangthang[/color][color=#007700];} public [/color][color=#0000bb]void setluonghangthang[/color][color=#007700]([/color][color=#0000bb]long luonghangthang[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luonghangthang [/color][color=#007700]= [/color][color=#0000bb]luonghangthang[/color][color=#007700];} } class [/color][color=#0000bb]giamdoc [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]long tientieuhangthang[/color][color=#007700]; public [/color][color=#0000bb]long gettientieuhangthang[/color][color=#007700]() {return [/color][color=#0000bb]tientieuhangthang[/color][color=#007700];} public [/color][color=#0000bb]void settientieuhangthang[/color][color=#007700]([/color][color=#0000bb]long tientieuhangthang[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tientieuhangthang [/color][color=#007700]= [/color][color=#0000bb]tientieuhangthang[/color][color=#007700];} }[/color] 
    </blockquote></div>
    </div>
    </div>

  2. #42
    nhờ mọi ng xem hộ :d
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class nhansu (move your mouse to reveal the content)</noscript>

    class nhansu (open)
    class nhansu (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package tinh[/color][color=#007700].[/color][color=#0000bb]ke[/color][color=#007700].[/color][color=#0000bb]thua[/color][color=#007700]; class [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]string hoten[/color][color=#007700], [/color][color=#0000bb]mathe[/color][color=#007700];private [/color][color=#0000bb]int namsinh[/color][color=#007700]; public [/color][color=#0000bb]string gethoten [/color][color=#007700]() {return [/color][color=#0000bb]hoten[/color][color=#007700];}public [/color][color=#0000bb]void sethoten [/color][color=#007700]([/color][color=#0000bb]string hoten[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]hoten [/color][color=#007700]= [/color][color=#0000bb]hoten[/color][color=#007700];} public [/color][color=#0000bb]string getmathe [/color][color=#007700]() {return [/color][color=#0000bb]mathe[/color][color=#007700];}public [/color][color=#0000bb]void setmathe [/color][color=#007700]([/color][color=#0000bb]string mathe[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]mathe [/color][color=#007700]= [/color][color=#0000bb]mathe[/color][color=#007700];} public [/color][color=#0000bb]int getnamsinh [/color][color=#007700]() {return [/color][color=#0000bb]namsinh[/color][color=#007700];}public [/color][color=#0000bb]void setnamsinh [/color][color=#007700]([/color][color=#0000bb]int namsinh[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]namsinh[/color][color=#007700];}}[/color] 
    </blockquote></div>
    </div>
    </div>

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class sinhvien (move your mouse to reveal the content)</noscript>

    class sinhvien (open)
    class sinhvien (close)

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



    Mã nguồn PHP:
    [color=#000000]
    package tinh[/color][color=#007700].[/color][color=#0000bb]ke[/color][color=#007700].[/color][color=#0000bb]thua[/color][color=#007700]; class [/color][color=#0000bb]sinhvien [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]int nohocphi[/color][color=#007700]; public [/color][color=#0000bb]int getnohocphi [/color][color=#007700]() {return [/color][color=#0000bb]nohocphi[/color][color=#007700];}public [/color][color=#0000bb]void setnohocphi [/color][color=#007700]([/color][color=#0000bb]int nohocphi[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]nohocphi [/color][color=#007700]= [/color][color=#0000bb]nohocphi[/color][color=#007700];}}[/color] 
    </blockquote></div>
    </div>
    </div>

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class giamdoc (move your mouse to reveal the content)</noscript>

    class giamdoc (open)
    class giamdoc (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package tinh[/color][color=#007700].[/color][color=#0000bb]ke[/color][color=#007700].[/color][color=#0000bb]thua[/color][color=#007700]; class [/color][color=#0000bb]giamdoc [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]int tientieuhangthang[/color][color=#007700]; public [/color][color=#0000bb]int gettientieuhangthang [/color][color=#007700]() {return [/color][color=#0000bb]tientieuhangthang[/color][color=#007700];}public [/color][color=#0000bb]void settientieuhangthang [/color][color=#007700]([/color][color=#0000bb]int tientieuhangthang[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]tientieuhangthang [/color][color=#007700]= [/color][color=#0000bb]tientieuhangthang[/color][color=#007700];}}[/color] 
    </blockquote></div>
    </div>
    </div>

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class giaovien (move your mouse to reveal the content)</noscript>

    class giaovien (open)
    class giaovien (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package tinh[/color][color=#007700].[/color][color=#0000bb]ke[/color][color=#007700].[/color][color=#0000bb]thua[/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]giaovien [/color][color=#007700]extends [/color][color=#0000bb]nhansu [/color][color=#007700]{private [/color][color=#0000bb]int luong[/color][color=#007700]; public [/color][color=#0000bb]int getluong [/color][color=#007700]() {return [/color][color=#0000bb]luong[/color][color=#007700];}public [/color][color=#0000bb]void setluong [/color][color=#007700]([/color][color=#0000bb]int luong[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]luong [/color][color=#007700]= [/color][color=#0000bb]luong[/color][color=#007700];} public [/color][color=#0000bb]void input [/color][color=#007700]() {[/color][color=#0000bb]scanner inp [/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 thông tin giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"họ tên giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]sethoten[/color][color=#007700]([/color][color=#0000bb]inp[/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]"mã thẻ: "[/color][color=#007700]);[/color][color=#0000bb]setmathe[/color][color=#007700]([/color][color=#0000bb]inp[/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]"năm sinh: "[/color][color=#007700]);[/color][color=#0000bb]setnamsinh[/color][color=#007700]([/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"luong: "[/color][color=#007700]);[/color][color=#0000bb]setluong[/color][color=#007700]([/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void showgiaovien [/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 giáo viên: "[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"họ tên:" [/color][color=#007700]+ [/color][color=#0000bb]gethoten[/color][color=#007700]() + [/color][color=#dd0000]" mã thẻ:" [/color][color=#007700]+ [/color][color=#0000bb]getmathe[/color][color=#007700]() + [/color][color=#dd0000]" năm sinh:" [/color][color=#007700]+ [/color][color=#0000bb]getnamsinh[/color][color=#007700]() + [/color][color=#dd0000]" lương:" [/color][color=#007700]+ [/color][color=#0000bb]getluong[/color][color=#007700]());}}[/color] 
    </blockquote></div>
    </div>
    </div>

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>class main (move your mouse to reveal the content)</noscript>

    class main (open)
    class main (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package tinh[/color][color=#007700].[/color][color=#0000bb]ke[/color][color=#007700].[/color][color=#0000bb]thua[/color][color=#007700]; public class [/color][color=#0000bb]main [/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]giaovien gv [/color][color=#007700]= new [/color][color=#0000bb]giaovien[/color][color=#007700]();[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]input[/color][color=#007700]();[/color][color=#0000bb]gv[/color][color=#007700].[/color][color=#0000bb]showgiaovien[/color][color=#007700]();}}[/color] 
    </blockquote></div>
    </div>
    </div>

  3. #43
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    package androi[/color][color=#007700].[/color][color=#0000bb]vn[/color][color=#007700]; [/color][color=#ff8000]/** * bài 1: dùng tính kế thừa khai báo 3 class: class "sinh viên" gồm các thuộc * tính: họ tên, năm sinh, mã thẻ, tiền học phí còn nợ. class "giảng viên" gồm * các thuộc tính: họ tên, năm sinh, mã thẻ, tiền lương hàng tháng. class * "giám đốc" gồm các thuộc tính: họ tên, năm sinh, mã thẻ, tiền tiêu hàng * tháng. * * các thuộc tính để private, truy cập các thuộc tính sử dụng phương thức getter * và setter tạo 1 đối tượng giảng viên, giá trị nhập vào từ bàn phím, in thông * tin ra ngoài màn hình console */[/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]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]string name16[/color][color=#007700], [/color][color=#0000bb]namecode16[/color][color=#007700]; public [/color][color=#0000bb]string getname16[/color][color=#007700]() {return [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]void setname16[/color][color=#007700]([/color][color=#0000bb]string name16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name16 [/color][color=#007700]= [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]string getnamecode16[/color][color=#007700]() {return [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]void setnamecode16[/color][color=#007700]([/color][color=#0000bb]string namecode16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namecode16 [/color][color=#007700]= [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]int getyear16[/color][color=#007700]() {return [/color][color=#0000bb]year16[/color][color=#007700];} public [/color][color=#0000bb]void setyear16[/color][color=#007700]([/color][color=#0000bb]int year16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]year16 [/color][color=#007700]= [/color][color=#0000bb]year16[/color][color=#007700];} private [/color][color=#0000bb]int year16[/color][color=#007700];} class [/color][color=#0000bb]ceo [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]int moneyceo[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyceo[/color][color=#007700]() {return [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyceo[/color][color=#007700]([/color][color=#0000bb]int moneyceo[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyceo [/color][color=#007700]= [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void inputceo16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerceo16 [/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]"nhap thong so ceo:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyceo[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputceo16[/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 so ceo da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyceo[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]teacher16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneyteaching16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyteaching16[/color][color=#007700]() {return [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]int moneyteaching16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyteaching16 [/color][color=#007700]= [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void inputteacher16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerteacher16 [/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]"nhap thong so giao vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputteacher16[/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 so giao vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyteaching16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]student16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneystudying16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneystudying16[/color][color=#007700]() {return [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]int moneystudying16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneystudying16 [/color][color=#007700]= [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void inputstudent16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerstudent16 [/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]"nhap thong so sinh vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputstudent16[/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 so sinh vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneystudying16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} public class [/color][color=#0000bb]bai16 [/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 scannerbai16 [/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]"thanh vien ban muon khoi tao la:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long nhan phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"1. sinh vien"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"2. giao vien"[/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]"3. ceo(giam doc)"[/color][color=#007700]);[/color][color=#0000bb]int x [/color][color=#007700]= [/color][color=#0000bb]scannerbai16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#ff8000]// boolean test = true; // label:[/color][color=#007700]if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]1[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 sinh vien[/color][color=#0000bb]student16 a [/color][color=#007700]= new [/color][color=#0000bb]student16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputstudent16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputstudent16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]2[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 giao vien[/color][color=#0000bb]teacher16 a [/color][color=#007700]= new [/color][color=#0000bb]teacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputteacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputteacher16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]3[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 ceo[/color][color=#0000bb]ceo a [/color][color=#007700]= new [/color][color=#0000bb]ceo[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputceo16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputceo16[/color][color=#007700]();} else {[/color][color=#ff8000]// test = false;[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ban nhap sai phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long chay lai chuong trinh"[/color][color=#007700]);}[/color][color=#ff8000]// if (test == false) {// system.out.println("ban nhap sai phim lua chon:");// system.out.println("vui long chay lai chuong trinh");// // continue label;// }[/color][color=#007700]} }[/color] 

  4. #44
    Ngày tham gia
    Apr 2015
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    package androi[/color][color=#007700].[/color][color=#0000bb]vn[/color][color=#007700]; [/color][color=#ff8000]/** * bài 1: dùng tính kế thừa khai báo 3 class: class "sinh viên" gồm các thuộc * tính: họ tên, năm sinh, mã thẻ, tiền học phí còn nợ. class "giảng viên" gồm * các thuộc tính: họ tên, năm sinh, mã thẻ, tiền lương hàng tháng. class * "giám đốc" gồm các thuộc tính: họ tên, năm sinh, mã thẻ, tiền tiêu hàng * tháng. * * các thuộc tính để private, truy cập các thuộc tính sử dụng phương thức getter * và setter tạo 1 đối tượng giảng viên, giá trị nhập vào từ bàn phím, in thông * tin ra ngoài màn hình console */[/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]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]string name16[/color][color=#007700], [/color][color=#0000bb]namecode16[/color][color=#007700]; public [/color][color=#0000bb]string getname16[/color][color=#007700]() {return [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]void setname16[/color][color=#007700]([/color][color=#0000bb]string name16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name16 [/color][color=#007700]= [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]string getnamecode16[/color][color=#007700]() {return [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]void setnamecode16[/color][color=#007700]([/color][color=#0000bb]string namecode16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namecode16 [/color][color=#007700]= [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]int getyear16[/color][color=#007700]() {return [/color][color=#0000bb]year16[/color][color=#007700];} public [/color][color=#0000bb]void setyear16[/color][color=#007700]([/color][color=#0000bb]int year16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]year16 [/color][color=#007700]= [/color][color=#0000bb]year16[/color][color=#007700];} private [/color][color=#0000bb]int year16[/color][color=#007700];} class [/color][color=#0000bb]ceo [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]int moneyceo[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyceo[/color][color=#007700]() {return [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyceo[/color][color=#007700]([/color][color=#0000bb]int moneyceo[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyceo [/color][color=#007700]= [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void inputceo16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerceo16 [/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]"nhap thong so ceo:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyceo[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputceo16[/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 so ceo da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyceo[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]teacher16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneyteaching16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyteaching16[/color][color=#007700]() {return [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]int moneyteaching16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyteaching16 [/color][color=#007700]= [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void inputteacher16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerteacher16 [/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]"nhap thong so giao vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputteacher16[/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 so giao vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyteaching16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]student16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneystudying16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneystudying16[/color][color=#007700]() {return [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]int moneystudying16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneystudying16 [/color][color=#007700]= [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void inputstudent16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerstudent16 [/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]"nhap thong so sinh vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputstudent16[/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 so sinh vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneystudying16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} public class [/color][color=#0000bb]bai16 [/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 scannerbai16 [/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]"thanh vien ban muon khoi tao la:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long nhan phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"1. sinh vien"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"2. giao vien"[/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]"3. ceo(giam doc)"[/color][color=#007700]);[/color][color=#0000bb]int x [/color][color=#007700]= [/color][color=#0000bb]scannerbai16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]boolean test [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]label[/color][color=#007700]: if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]1[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 sinh vien[/color][color=#0000bb]student16 a [/color][color=#007700]= new [/color][color=#0000bb]student16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputstudent16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputstudent16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]2[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 giao vien[/color][color=#0000bb]teacher16 a [/color][color=#007700]= new [/color][color=#0000bb]teacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputteacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputteacher16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]3[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 ceo[/color][color=#0000bb]ceo a [/color][color=#007700]= new [/color][color=#0000bb]ceo[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputceo16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputceo16[/color][color=#007700]();} else {[/color][color=#0000bb]test [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700];[/color][color=#ff8000]// system.out.println("ban nhap sai phim lua chon:");// system.out.println("vui long chay lai chuong trinh");[/color][color=#007700]}if ([/color][color=#0000bb]test [/color][color=#007700]== [/color][color=#0000bb]false[/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]"ban nhap sai phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long chay lai chuong trinh"[/color][color=#007700]);continue [/color][color=#0000bb]label[/color][color=#007700];}} }[/color] 

  5. #45
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    Trích dẫn Gửi bởi nguoikienthiet

    Mã nguồn PHP:
    [color=#000000]
    package androi[/color][color=#007700].[/color][color=#0000bb]vn[/color][color=#007700]; [/color][color=#ff8000]/*** bài 1: dùng tính kế thừa khai báo 3 class: class "sinh viên" gồm các thuộc* tính: họ tên, năm sinh, mã thẻ, tiền học phí còn nợ. class "giảng viên" gồm* các thuộc tính: họ tên, năm sinh, mã thẻ, tiền lương hàng tháng. class* "giám đốc" gồm các thuộc tính: họ tên, năm sinh, mã thẻ, tiền tiêu hàng* tháng.** các thuộc tính để private, truy cập các thuộc tính sử dụng phương thức getter* và setter tạo 1 đối tượng giảng viên, giá trị nhập vào từ bàn phím, in thông* tin ra ngoài màn hình console*/[/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]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]string name16[/color][color=#007700], [/color][color=#0000bb]namecode16[/color][color=#007700]; public [/color][color=#0000bb]string getname16[/color][color=#007700]() {return [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]void setname16[/color][color=#007700]([/color][color=#0000bb]string name16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]name16 [/color][color=#007700]= [/color][color=#0000bb]name16[/color][color=#007700];} public [/color][color=#0000bb]string getnamecode16[/color][color=#007700]() {return [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]void setnamecode16[/color][color=#007700]([/color][color=#0000bb]string namecode16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]namecode16 [/color][color=#007700]= [/color][color=#0000bb]namecode16[/color][color=#007700];} public [/color][color=#0000bb]int getyear16[/color][color=#007700]() {return [/color][color=#0000bb]year16[/color][color=#007700];} public [/color][color=#0000bb]void setyear16[/color][color=#007700]([/color][color=#0000bb]int year16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]year16 [/color][color=#007700]= [/color][color=#0000bb]year16[/color][color=#007700];} private [/color][color=#0000bb]int year16[/color][color=#007700];} class [/color][color=#0000bb]ceo [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{private [/color][color=#0000bb]int moneyceo[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyceo[/color][color=#007700]() {return [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyceo[/color][color=#007700]([/color][color=#0000bb]int moneyceo[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyceo [/color][color=#007700]= [/color][color=#0000bb]moneyceo[/color][color=#007700];} public [/color][color=#0000bb]void inputceo16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerceo16 [/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]"nhap thong so ceo:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyceo[/color][color=#007700]([/color][color=#0000bb]scannerceo16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputceo16[/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 so ceo da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyceo[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]teacher16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneyteaching16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneyteaching16[/color][color=#007700]() {return [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]int moneyteaching16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneyteaching16 [/color][color=#007700]= [/color][color=#0000bb]moneyteaching16[/color][color=#007700];} public [/color][color=#0000bb]void inputteacher16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerteacher16 [/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]"nhap thong so giao vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneyteaching16[/color][color=#007700]([/color][color=#0000bb]scannerteacher16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputteacher16[/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 so giao vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneyteaching16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} class [/color][color=#0000bb]student16 [/color][color=#007700]extends [/color][color=#0000bb]ifmormation [/color][color=#007700]{ private [/color][color=#0000bb]int moneystudying16[/color][color=#007700]; public [/color][color=#0000bb]int getmoneystudying16[/color][color=#007700]() {return [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]int moneystudying16[/color][color=#007700]) {[/color][color=#0000bb]this[/color][color=#007700].[/color][color=#0000bb]moneystudying16 [/color][color=#007700]= [/color][color=#0000bb]moneystudying16[/color][color=#007700];} public [/color][color=#0000bb]void inputstudent16[/color][color=#007700]() {[/color][color=#0000bb]scanner scannerstudent16 [/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]"nhap thong so sinh vien:"[/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]"ho ten:"[/color][color=#007700]);[/color][color=#0000bb]setname16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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 so:"[/color][color=#007700]);[/color][color=#0000bb]setnamecode16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]setyear16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/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]"tien chi tieu hang thang: (vnd)"[/color][color=#007700]);[/color][color=#0000bb]setmoneystudying16[/color][color=#007700]([/color][color=#0000bb]scannerstudent16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]());} public [/color][color=#0000bb]void outputstudent16[/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 so sinh vien da nhap:"[/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]"ho ten: " [/color][color=#007700]+ [/color][color=#0000bb]getname16[/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 so: " [/color][color=#007700]+ [/color][color=#0000bb]getnamecode16[/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]"nam sinh: " [/color][color=#007700]+ [/color][color=#0000bb]getyear16[/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]"tien chi tieu hang thang: " [/color][color=#007700]+ [/color][color=#0000bb]getmoneystudying16[/color][color=#007700]() + [/color][color=#dd0000]" (vnd)"[/color][color=#007700]);}} public class [/color][color=#0000bb]bai16 [/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 scannerbai16 [/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]"thanh vien ban muon khoi tao la:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long nhan phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"1. sinh vien"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"2. giao vien"[/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]"3. ceo(giam doc)"[/color][color=#007700]);[/color][color=#0000bb]int x [/color][color=#007700]= [/color][color=#0000bb]scannerbai16[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]boolean test [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]label[/color][color=#007700]: if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]1[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 sinh vien[/color][color=#0000bb]student16 a [/color][color=#007700]= new [/color][color=#0000bb]student16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputstudent16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputstudent16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]2[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 giao vien[/color][color=#0000bb]teacher16 a [/color][color=#007700]= new [/color][color=#0000bb]teacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputteacher16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputteacher16[/color][color=#007700]();} else if ([/color][color=#0000bb]x [/color][color=#007700]== [/color][color=#0000bb]3[/color][color=#007700]) {[/color][color=#ff8000]// khoi tao 1 ceo[/color][color=#0000bb]ceo a [/color][color=#007700]= new [/color][color=#0000bb]ceo[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]inputceo16[/color][color=#007700]();[/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]outputceo16[/color][color=#007700]();} else {[/color][color=#0000bb]test [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700];[/color][color=#ff8000]// system.out.println("ban nhap sai phim lua chon:");// system.out.println("vui long chay lai chuong trinh");[/color][color=#007700]}if ([/color][color=#0000bb]test [/color][color=#007700]== [/color][color=#0000bb]false[/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]"ban nhap sai phim lua chon:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"vui long chay lai chuong trinh"[/color][color=#007700]);continue [/color][color=#0000bb]label[/color][color=#007700];}} }[/color] 
    tớ dùng continue đến label: như trong đoạn code mà nó cứ báo lỗi hoài

  6. #46
    Ngày tham gia
    Apr 2014
    Bài viết
    0
    Trích dẫn Gửi bởi nguoikienthiet
    tớ dùng continue đến label: như trong đoạn code mà nó cứ báo lỗi hoài
    nó báo
    exception in thread "main" java.lang.error: unresolved compilation problem:
    the label label is missing
    at androi.vn.bai16.main(bai16.java:183)

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

    b1 (open)
    b1 (close)

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


    Mã:
    package kethua;
    import java.util.scanner;
     class nsu {
     private string hoten;
     private int namsinh;
     private string ma;
    public string gethoten() {
    return hoten;
    }
    public void sethoten(string hoten) {
    hoten = hoten;
    }
    public int getnamsinh() {
    return namsinh;
    }
    public void setnamsinh(int namsinh) {
    namsinh = namsinh;
    }
    public string getma() {
    return ma;
    }
    public void setma(string ma) {
    ma = ma;
    }
     
     
     
     
    }
    class hs extends nsu{
    private int thpcn;
     
     
     
     
    public int getthpcn() {
    return thpcn;
    }
     
     
     
     
    public void setthpcn(int thpcn) {
    thpcn = thpcn;
    }
     
    }
    class gv extends nsu{
    private int luong;
     
     
     
     
    public int getluong() {
    return luong;
    }
     
     
     
     
    public void setluong(int luong) {
    this.luong = luong;
    }
    }
    class gd extends nsu {
    private long tientieu; //giam doc ma !!!!!!! 8)
     
     
     
     
    public long gettientieu() {
    return tientieu;
    }
     
     
     
     
    public void settientieu(long tientieu) {
    this.tientieu = tientieu;
    }
     
     
     
     
    }
    public class ns{
    public static void main (string[] args){
    gv a=new gv();
    scanner inp= new scanner(system.in);
    system.out.println("nhap ten giang vien  "); a.sethoten(inp.nextline());
    system.out.println("nhap nam sinh giang vien "+a.gethoten()); a.setnamsinh(inp.nextint());
    system.out.println("nhap ma the giang vien "+a.gethoten());a.setma(inp.nextline());
    system.out.println("nhap luong");a.setluong(inp.nextint());
    system.out.println("ten: "+a.gethoten());
    system.out.println("nam sinh"+a.getnamsinh());
    system.out.println("ma the"+a.getma());
    system.out.println("luong "+a.getluong());
    }
    }
    </blockquote></div>
    </div>
    </div>

Trang 5 của 5 Đầu tiênĐầu tiên ... 345

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
  •