Trang 11 của 13 Đầu tiênĐầu tiên ... 910111213 CuốiCuối
Kết quả 101 đến 110 của 124
  1. #101
    Ngày tham gia
    Mar 2014
    Bài viết
    0
    xem hộ mình nhé !



    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]luong1 [/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]string ten[/color][color=#007700];[/color][color=#0000bb]double toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700], [/color][color=#0000bb]trungbinh[/color][color=#007700];[/color][color=#0000bb]scanner nhapdulieu [/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 tên sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]"tên sinh viên là: " [/color][color=#007700]+ [/color][color=#0000bb]ten[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm toán: "[/color][color=#007700]);[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm lý: "[/color][color=#007700]);[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm hóa: "[/color][color=#007700]);[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/color][color=#0000bb]trungbinh [/color][color=#007700]= ([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm trung bình của sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" là: " [/color][color=#007700]+ [/color][color=#0000bb]trungbinh[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]8[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh giỏi ! chúc mừng ! "[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh khá !"[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh trung bình"[/color][color=#007700]); } }[/color] 

  2. #102
    Ngày tham gia
    Oct 2015
    Bài viết
    0
    Trích dẫn Gửi bởi vn5chau_com
    xem hộ mình nhé !



    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]luong1 [/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]string ten[/color][color=#007700];[/color][color=#0000bb]double toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700], [/color][color=#0000bb]trungbinh[/color][color=#007700];[/color][color=#0000bb]scanner nhapdulieu [/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 tên sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]"tên sinh viên là: " [/color][color=#007700]+ [/color][color=#0000bb]ten[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm toán: "[/color][color=#007700]);[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm lý: "[/color][color=#007700]);[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm hóa: "[/color][color=#007700]);[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/color][color=#0000bb]trungbinh [/color][color=#007700]= ([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm trung bình của sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" là: " [/color][color=#007700]+ [/color][color=#0000bb]trungbinh[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]8[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh giỏi ! chúc mừng ! "[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh khá !"[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh trung bình"[/color][color=#007700]); } }[/color] 
    đúng rồi đó bạn.

  3. #103
    Ngày tham gia
    Dec 2014
    Bài viết
    0
    Trích dẫn Gửi bởi vn5chau_com
    xem hộ mình nhé !



    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]luong1 [/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]string ten[/color][color=#007700];[/color][color=#0000bb]double toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700], [/color][color=#0000bb]trungbinh[/color][color=#007700];[/color][color=#0000bb]scanner nhapdulieu [/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 tên sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]"tên sinh viên là: " [/color][color=#007700]+ [/color][color=#0000bb]ten[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm toán: "[/color][color=#007700]);[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm lý: "[/color][color=#007700]);[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm hóa: "[/color][color=#007700]);[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/color][color=#0000bb]trungbinh [/color][color=#007700]= ([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm trung bình của sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" là: " [/color][color=#007700]+ [/color][color=#0000bb]trungbinh[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]8[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh giỏi ! chúc mừng ! "[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh khá !"[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh trung bình"[/color][color=#007700]); } }[/color] 
    đúng rồi đó bạn.

  4. #104
    Ngày tham gia
    May 2014
    Bài viết
    0
    Trích dẫn Gửi bởi vn5chau_com
    xem hộ mình nhé !



    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]luong1 [/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]string ten[/color][color=#007700];[/color][color=#0000bb]double toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700], [/color][color=#0000bb]trungbinh[/color][color=#007700];[/color][color=#0000bb]scanner nhapdulieu [/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 tên sinh viên: "[/color][color=#007700]);[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/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]"tên sinh viên là: " [/color][color=#007700]+ [/color][color=#0000bb]ten[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm toán: "[/color][color=#007700]);[/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm lý: "[/color][color=#007700]);[/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/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 điểm hóa: "[/color][color=#007700]);[/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextdouble[/color][color=#007700]();[/color][color=#0000bb]trungbinh [/color][color=#007700]= ([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"điểm trung bình của sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" là: " [/color][color=#007700]+ [/color][color=#0000bb]trungbinh[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]8[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên " [/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh giỏi ! chúc mừng ! "[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh khá !"[/color][color=#007700]);if([/color][color=#0000bb]trungbinh[/color][color=#007700]<[/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]trungbinh[/color][color=#007700]>=[/color][color=#0000bb]5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh viên "[/color][color=#007700]+ [/color][color=#0000bb]ten [/color][color=#007700]+ [/color][color=#dd0000]" đạt danh hiệu: học sinh trung bình"[/color][color=#007700]); } }[/color] 
    đúng rồi đó bạn.

  5. #105
    Ngày tham gia
    May 2015
    Bài viết
    0
    xem ho em cai!!


    Mã nguồn PHP:
    [color=#000000]
    package hoangthanhlong[/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]nhapxuatdulieu [/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]string hoten[/color][color=#007700];[/color][color=#0000bb]float namsinh[/color][color=#007700],[/color][color=#0000bb]toan[/color][color=#007700],[/color][color=#0000bb]li[/color][color=#007700],[/color][color=#0000bb]hoa[/color][color=#007700];[/color][color=#0000bb]scanner dulieu [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ho va ten:"[/color][color=#007700]);[/color][color=#0000bb]hoten[/color][color=#007700]=[/color][color=#0000bb]dulieu[/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]"diem toan:"[/color][color=#007700]);[/color][color=#0000bb]toan[/color][color=#007700]=[/color][color=#0000bb]dulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem li:"[/color][color=#007700]);[/color][color=#0000bb]li[/color][color=#007700]=[/color][color=#0000bb]dulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem hoa:"[/color][color=#007700]);[/color][color=#0000bb]hoa[/color][color=#007700]=[/color][color=#0000bb]dulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]float diemtrungbinh[/color][color=#007700]=([/color][color=#0000bb]toan[/color][color=#007700]+[/color][color=#0000bb]li[/color][color=#007700]+[/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];if ([/color][color=#0000bb]diemtrungbinh[/color][color=#007700]>[/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemtrungbinh[/color][color=#007700]<=[/color][color=#0000bb]5[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoc sinh trung binh"[/color][color=#007700]);}if ([/color][color=#0000bb]diemtrungbinh[/color][color=#007700]>[/color][color=#0000bb]5[/color][color=#007700]&&[/color][color=#0000bb]diemtrungbinh[/color][color=#007700]<[/color][color=#0000bb]8[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoc sinh kha"[/color][color=#007700]);}if ([/color][color=#0000bb]diemtrungbinh[/color][color=#007700]>=[/color][color=#0000bb]8 [/color][color=#007700]&& [/color][color=#0000bb]diemtrungbinh[/color][color=#007700]<=[/color][color=#0000bb]10[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"hoc sinh gioi"[/color][color=#007700]);}else{[/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 sai du lieu diem"[/color][color=#007700]);} } }[/color] 

  6. #106
    Ngày tham gia
    Jan 2015
    Bài viết
    0
    xem hộ mình nhá .
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>homework (move your mouse to reveal the content)</noscript>

    homework (open)
    homework (close)

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


    Mã nguồn PHP:
    [color=#000000]
    package javaandroid[/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]lesssion07_v2 [/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]sinhvien stu [/color][color=#007700]= new [/color][color=#0000bb]sinhvien[/color][color=#007700]();[/color][color=#0000bb]stu[/color][color=#007700].[/color][color=#0000bb]info[/color][color=#007700]();[/color][color=#0000bb]stu[/color][color=#007700].[/color][color=#0000bb]xeploai[/color][color=#007700]();}} class [/color][color=#0000bb]sinhvien[/color][color=#007700]{private [/color][color=#0000bb]string ten[/color][color=#007700];private [/color][color=#0000bb]int namsinh[/color][color=#007700];private [/color][color=#0000bb]float diemtoan[/color][color=#007700], [/color][color=#0000bb]diemly[/color][color=#007700], [/color][color=#0000bb]diemhoa[/color][color=#007700]; public [/color][color=#0000bb]void info[/color][color=#007700]() {[/color][color=#0000bb]scanner inputdata [/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 sinh vien:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ho va ten : "[/color][color=#007700]);[/color][color=#0000bb]ten [/color][color=#007700]= [/color][color=#0000bb]inputdata[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();do {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nam sinh:"[/color][color=#007700]);[/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]inputdata[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();} while ([/color][color=#0000bb]namsinh [/color][color=#007700]>= [/color][color=#0000bb]2014[/color][color=#007700]);do {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem toan: "[/color][color=#007700]);[/color][color=#0000bb]diemtoan [/color][color=#007700]= [/color][color=#0000bb]inputdata[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } while (!([/color][color=#0000bb]diemtoan [/color][color=#007700]>= [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemtoan [/color][color=#007700]<=[/color][color=#0000bb]10[/color][color=#007700]));do {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem ly: "[/color][color=#007700]);[/color][color=#0000bb]diemly [/color][color=#007700]= [/color][color=#0000bb]inputdata[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } while (!([/color][color=#0000bb]diemly [/color][color=#007700]>= [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemly [/color][color=#007700]<=[/color][color=#0000bb]10[/color][color=#007700]));do {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem hoa: "[/color][color=#007700]);[/color][color=#0000bb]diemhoa [/color][color=#007700]= [/color][color=#0000bb]inputdata[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } while (!([/color][color=#0000bb]diemhoa [/color][color=#007700]>= [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemhoa [/color][color=#007700]<=[/color][color=#0000bb]10[/color][color=#007700]));}public [/color][color=#0000bb]void xeploai[/color][color=#007700]() {[/color][color=#0000bb]float diemtb[/color][color=#007700];[/color][color=#0000bb]diemtb [/color][color=#007700]= ([/color][color=#0000bb]diemtoan [/color][color=#007700]+ [/color][color=#0000bb]diemly [/color][color=#007700]+ [/color][color=#0000bb]diemhoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700];if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]8.0[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700]+ [/color][color=#dd0000]" la sinh vien gioi."[/color][color=#007700]);else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>=[/color][color=#0000bb]6.5[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700]+ [/color][color=#dd0000]" la sinh vien kha!"[/color][color=#007700]);else if ([/color][color=#0000bb]diemtb [/color][color=#007700]> [/color][color=#0000bb]4.0[/color][color=#007700])[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]ten[/color][color=#007700]+ [/color][color=#dd0000]" la sinh vien trung binh"[/color][color=#007700]);}}[/color] 
    </blockquote></div>
    </div>
    </div>

  7. #107
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    mình đang bị tắc ở phần năm nhuận, có ai giúp đỡ mình được không với @@!





    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]bai6b [/color][color=#007700]{ public [/color][color=#0000bb]int ngay[/color][color=#007700], [/color][color=#0000bb]thang[/color][color=#007700], [/color][color=#0000bb]nam[/color][color=#007700], [/color][color=#0000bb]nam_nhuan[/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]int ngay[/color][color=#007700], [/color][color=#0000bb]thang[/color][color=#007700], [/color][color=#0000bb]nam[/color][color=#007700]; [/color][color=#0000bb]scanner date [/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 ngay: "[/color][color=#007700]); [/color][color=#0000bb]ngay [/color][color=#007700]= [/color][color=#0000bb]date[/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]"nhap thang: "[/color][color=#007700]); [/color][color=#0000bb]thang [/color][color=#007700]= [/color][color=#0000bb]date[/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]"nhap nam: "[/color][color=#007700]); [/color][color=#0000bb]nam [/color][color=#007700]= [/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]ngay[/color][color=#007700]) > [/color][color=#0000bb]31 [/color][color=#007700]|| [/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]ngay[/color][color=#007700]) <= [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bạn nhập sai ngày"[/color][color=#007700]); } else if ([/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]thang[/color][color=#007700]) > [/color][color=#0000bb]12 [/color][color=#007700]|| [/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]thang[/color][color=#007700]) <= [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bạn nhập sai tháng"[/color][color=#007700]); } else if ([/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]nam[/color][color=#007700]) < [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ban da nhap sai nam"[/color][color=#007700]); } else { switch ([/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]thang[/color][color=#007700])) { case [/color][color=#0000bb]1[/color][color=#007700]: case [/color][color=#0000bb]3[/color][color=#007700]: case [/color][color=#0000bb]5[/color][color=#007700]: case [/color][color=#0000bb]7[/color][color=#007700]: case [/color][color=#0000bb]8[/color][color=#007700]: case [/color][color=#0000bb]10[/color][color=#007700]: case [/color][color=#0000bb]12[/color][color=#007700]: [/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" [/color][color=#007700]+ [/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]thang[/color][color=#007700]) + [/color][color=#dd0000]"có 31 ngày"[/color][color=#007700]); break; case [/color][color=#0000bb]2[/color][color=#007700]: if ([/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nam_nhuan[/color][color=#007700])()) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thang 2 co 29 ngay"[/color][color=#007700]); }else{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thang 2 co 28 ngay"[/color][color=#007700]); } break; default: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"thang"[/color][color=#007700]+[/color][color=#0000bb]date[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]([/color][color=#0000bb]thang[/color][color=#007700])+[/color][color=#dd0000]"co 30 ngay"[/color][color=#007700]); } } } public [/color][color=#0000bb]boolean nam_nhuan[/color][color=#007700]() { if ([/color][color=#0000bb]nam [/color][color=#007700]% [/color][color=#0000bb]4 [/color][color=#007700]== [/color][color=#0000bb]0[/color][color=#007700]) { if ([/color][color=#0000bb]nam [/color][color=#007700]% [/color][color=#0000bb]100 [/color][color=#007700]!= [/color][color=#0000bb]0[/color][color=#007700]) { return [/color][color=#0000bb]true[/color][color=#007700]; } else if ([/color][color=#0000bb]nam [/color][color=#007700]% [/color][color=#0000bb]400 [/color][color=#007700]== [/color][color=#0000bb]0[/color][color=#007700]) { return [/color][color=#0000bb]true[/color][color=#007700]; } } return [/color][color=#0000bb]false[/color][color=#007700]; }}[/color] 

  8. #108
    Ngày tham gia
    Oct 2014
    Bài viết
    0
    Trích dẫn Gửi bởi manhtanbao
    mình đang bị tắc ở phần năm nhuận, có ai giúp đỡ mình được không với @@!
    bạn tham khảo class date ntn xem sao ?
    <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]date[/color][color=#007700]{ private [/color][color=#0000bb]int month[/color][color=#007700]; [/color][color=#ff8000]// 1-12 [/color][color=#007700]private [/color][color=#0000bb]int day[/color][color=#007700]; [/color][color=#ff8000]// 1-31 based on month [/color][color=#007700]private [/color][color=#0000bb]int year[/color][color=#007700]; [/color][color=#ff8000]// year > 0 // constructor: call checkmonth to confirm proper value for month; // call checkday to confirm proper value for day [/color][color=#007700]public [/color][color=#0000bb]date[/color][color=#007700]( [/color][color=#0000bb]int themonth[/color][color=#007700], [/color][color=#0000bb]int theday[/color][color=#007700], [/color][color=#0000bb]int theyear [/color][color=#007700]) { [/color][color=#0000bb]month [/color][color=#007700]= [/color][color=#0000bb]checkmonth[/color][color=#007700]( [/color][color=#0000bb]themonth [/color][color=#007700]); [/color][color=#ff8000]// validate month [/color][color=#0000bb]year [/color][color=#007700]= [/color][color=#0000bb]checkyear[/color][color=#007700]([/color][color=#0000bb]theyear[/color][color=#007700]); [/color][color=#ff8000]// could validate year [/color][color=#0000bb]day [/color][color=#007700]= [/color][color=#0000bb]checkday[/color][color=#007700]( [/color][color=#0000bb]theday [/color][color=#007700]); [/color][color=#ff8000]// validate day [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]printf[/color][color=#007700]( [/color][color=#dd0000]"date object constructor for date %s
    "[/color][color=#007700], [/color][color=#0000bb]this [/color][color=#007700]); } [/color][color=#ff8000]// end date constructor // utility method to confirm proper month value [/color][color=#007700]private [/color][color=#0000bb]int checkmonth[/color][color=#007700]( [/color][color=#0000bb]int testmonth [/color][color=#007700]) { if ( [/color][color=#0000bb]testmonth [/color][color=#007700]> [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]testmonth [/color][color=#007700]<= [/color][color=#0000bb]12 [/color][color=#007700]) [/color][color=#ff8000]// validate month [/color][color=#007700]return [/color][color=#0000bb]testmonth[/color][color=#007700]; else [/color][color=#ff8000]// month is invalid [/color][color=#007700]{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]printf[/color][color=#007700]( [/color][color=#dd0000]"invalid month (%d) set to 1."[/color][color=#007700], [/color][color=#0000bb]testmonth [/color][color=#007700]); return [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#ff8000]// maintain object in consistent state [/color][color=#007700]} [/color][color=#ff8000]// end else [/color][color=#007700]} [/color][color=#ff8000]// end method checkmonth // utility method to confirm proper day value based on month and year [/color][color=#007700]private [/color][color=#0000bb]int checkday[/color][color=#007700]( [/color][color=#0000bb]int testday [/color][color=#007700]) { [/color][color=#0000bb]int dayspermonth[/color][color=#007700][] = { [/color][color=#0000bb]0[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]28[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700], [/color][color=#0000bb]31[/color][color=#007700], [/color][color=#0000bb]30[/color][color=#007700], [/color][color=#0000bb]31 [/color][color=#007700]}; [/color][color=#ff8000]// check if day in range for month [/color][color=#007700]if ( [/color][color=#0000bb]testday [/color][color=#007700]> [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]testday [/color][color=#007700]<= [/color][color=#0000bb]dayspermonth[/color][color=#007700][ [/color][color=#0000bb]month [/color][color=#007700]] ) return [/color][color=#0000bb]testday[/color][color=#007700]; [/color][color=#ff8000]// check for leap year [/color][color=#007700]if ( [/color][color=#0000bb]month [/color][color=#007700]== [/color][color=#0000bb]2 [/color][color=#007700]&& [/color][color=#0000bb]testday [/color][color=#007700]== [/color][color=#0000bb]29 [/color][color=#007700]&& ( [/color][color=#0000bb]year [/color][color=#007700]% [/color][color=#0000bb]400 [/color][color=#007700]== [/color][color=#0000bb]0 [/color][color=#007700]|| ( [/color][color=#0000bb]year [/color][color=#007700]% [/color][color=#0000bb]4 [/color][color=#007700]== [/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]year [/color][color=#007700]% [/color][color=#0000bb]100 [/color][color=#007700]!= [/color][color=#0000bb]0 [/color][color=#007700]) ) ) return [/color][color=#0000bb]testday[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]printf[/color][color=#007700]( [/color][color=#dd0000]"invalid day (%d) set to 1."[/color][color=#007700], [/color][color=#0000bb]testday [/color][color=#007700]); return [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#ff8000]// maintain object in consistent state [/color][color=#007700]} [/color][color=#ff8000]// end method checkday // year is not a negative [/color][color=#007700]private [/color][color=#0000bb]int checkyear[/color][color=#007700]([/color][color=#0000bb]int year[/color][color=#007700]) { if ([/color][color=#0000bb]year [/color][color=#007700]> [/color][color=#0000bb]0[/color][color=#007700]) return [/color][color=#0000bb]year[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]printf[/color][color=#007700]( [/color][color=#dd0000]"invalid year (%d) set to 1."[/color][color=#007700], [/color][color=#0000bb]year[/color][color=#007700]); return [/color][color=#0000bb]1[/color][color=#007700]; } [/color][color=#ff8000]// end method check year // return a string of the form month/day/year [/color][color=#007700]public [/color][color=#0000bb]string tostring[/color][color=#007700]() { return [/color][color=#0000bb]string[/color][color=#007700].[/color][color=#0000bb]format[/color][color=#007700]( [/color][color=#dd0000]"%d/%d/%d"[/color][color=#007700], [/color][color=#0000bb]month[/color][color=#007700], [/color][color=#0000bb]day[/color][color=#007700], [/color][color=#0000bb]year [/color][color=#007700]); } [/color][color=#ff8000]// end method tostring[/color] 
    </blockquote></div>
    </div>
    </div>

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

    bài 7 (open)
    bài 7 (close)

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


    Mã nguồn PHP:
    [color=#000000]
    [/color][color=#ff8000]//từ màn hình console, nhập dữ liệu của 1 sinh viên là //họ và tên, năm sinh, điểm toán, lý , hóa (kiểu số thực). //dựa vào điểm trung bình 3 môn in ra đó là học sinh giỏi, khá //hay trung bình[/color][color=#0000bb]package bai7a[/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]bai7a [/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]string hovaten[/color][color=#007700]; [/color][color=#0000bb]int namsinh[/color][color=#007700]; [/color][color=#0000bb]float toan[/color][color=#007700], [/color][color=#0000bb]ly[/color][color=#007700], [/color][color=#0000bb]hoa[/color][color=#007700], [/color][color=#0000bb]trungbinh[/color][color=#007700]; [/color][color=#0000bb]scanner nhapdulieu [/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 họ và tên: "[/color][color=#007700]); [/color][color=#0000bb]hovaten [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập năm sinh"[/color][color=#007700]); [/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]namsinh [/color][color=#007700]< [/color][color=#0000bb]1800 [/color][color=#007700]|| [/color][color=#0000bb]namsinh [/color][color=#007700]> [/color][color=#0000bb]3000[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bạn đã nhập sai năm sinh"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].exit([/color][color=#0000bb]0[/color][color=#007700]); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm toán"[/color][color=#007700]); [/color][color=#0000bb]toan [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm lý"[/color][color=#007700]); [/color][color=#0000bb]ly [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhập điểm hoá"[/color][color=#007700]); [/color][color=#0000bb]hoa [/color][color=#007700]= [/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if ([/color][color=#0000bb]toan [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]ly [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]hoa [/color][color=#007700]< [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bạn đã nhập sai điểm, hãy kiểm tra lại"[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].exit([/color][color=#0000bb]0[/color][color=#007700]); } [/color][color=#0000bb]trungbinh [/color][color=#007700]= (([/color][color=#0000bb]toan [/color][color=#007700]+ [/color][color=#0000bb]ly [/color][color=#007700]+ [/color][color=#0000bb]hoa[/color][color=#007700]) / [/color][color=#0000bb]3[/color][color=#007700]); [/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í sinh: " [/color][color=#007700]+ [/color][color=#0000bb]hovaten[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"năm sinh: " [/color][color=#007700]+ [/color][color=#0000bb]namsinh[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"trung bình: " [/color][color=#007700]+ [/color][color=#0000bb]trungbinh[/color][color=#007700]); if ([/color][color=#0000bb]trungbinh [/color][color=#007700]>= [/color][color=#0000bb]8.5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xếp loại: giỏi"[/color][color=#007700]); } else { if ([/color][color=#0000bb]trungbinh [/color][color=#007700]< [/color][color=#0000bb]8.5 [/color][color=#007700]& [/color][color=#0000bb]trungbinh [/color][color=#007700]>= [/color][color=#0000bb]5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xếp loại: khá"[/color][color=#007700]); } else { if ([/color][color=#0000bb]trungbinh [/color][color=#007700]< [/color][color=#0000bb]5[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xếp loại: trung bình"[/color][color=#007700]); } } } }}[/color] 
    </blockquote></div>
    </div>
    </div>

  10. #110
    Ngày tham gia
    Apr 2015
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]ttsv1 [/color][color=#007700]{ [/color][color=#ff8000]/** * @param args */[/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]sinhvien sv[/color][color=#007700]=new [/color][color=#0000bb]sinhvien[/color][color=#007700]();[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]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]"diem trung binh cua ban la "[/color][color=#007700]+[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]diemtb[/color][color=#007700]);[/color][color=#0000bb]sv[/color][color=#007700].[/color][color=#0000bb]xephl[/color][color=#007700](); } }class [/color][color=#0000bb]sinhvien[/color][color=#007700]{public [/color][color=#0000bb]string hoten[/color][color=#007700];public [/color][color=#0000bb]int namsinh[/color][color=#007700];public [/color][color=#0000bb]float diemtoan[/color][color=#007700],[/color][color=#0000bb]diemli[/color][color=#007700],[/color][color=#0000bb]diemhoa[/color][color=#007700],[/color][color=#0000bb]diemtb[/color][color=#007700];public [/color][color=#0000bb]void nhap[/color][color=#007700](){[/color][color=#0000bb]scanner scn1[/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]"sinh vien vui long nhap ho ten"[/color][color=#007700]);[/color][color=#0000bb]hoten[/color][color=#007700]=[/color][color=#0000bb]scn1[/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]"yeu cau nhap diem: toan li, hoa"[/color][color=#007700]); [/color][color=#0000bb]diemtoan[/color][color=#007700]=[/color][color=#0000bb]scn1[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]diemli[/color][color=#007700]=[/color][color=#0000bb]scn1[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]diemhoa[/color][color=#007700]=[/color][color=#0000bb]scn1[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700]();[/color][color=#0000bb]diemtb[/color][color=#007700]=([/color][color=#0000bb]diemtoan[/color][color=#007700]+[/color][color=#0000bb]diemli[/color][color=#007700]+[/color][color=#0000bb]diemhoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700]; } public [/color][color=#0000bb]void xephl[/color][color=#007700](){ if([/color][color=#0000bb]diemtb[/color][color=#007700]>[/color][color=#0000bb]0 [/color][color=#007700]&& [/color][color=#0000bb]diemtb[/color][color=#007700]<=[/color][color=#0000bb]10[/color][color=#007700]){if([/color][color=#0000bb]diemtb[/color][color=#007700]>[/color][color=#0000bb]3.5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb[/color][color=#007700]<[/color][color=#0000bb]6[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep hl trung binh"[/color][color=#007700]);}else if([/color][color=#0000bb]diemtb[/color][color=#007700]>[/color][color=#0000bb]6 [/color][color=#007700]&& [/color][color=#0000bb]diemtb[/color][color=#007700]<[/color][color=#0000bb]8[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep hl kha"[/color][color=#007700]);}else {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"xep loai gioi"[/color][color=#007700]);} }else{[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ket qua tra ve khong hop le"[/color][color=#007700]);}}}[/color] 

Trang 11 của 13 Đầu tiênĐầu tiên ... 910111213 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
  •