Format Dokumentasi

download Format Dokumentasi

of 28

description

tugas rpl

Transcript of Format Dokumentasi

  • 7/17/2019 Format Dokumentasi

    1/28

    TUGAS BESAR

    DOKUMENTASI DAN PROGRAM

    PEMROGRAMAN JAVA LANJUT

    Disusun oleh :

    [13020130103][RYAN FADEL AHMAD]

    PROGRAM STD! TE"N!"

    !NFORMAT!"A

    FA"LTAS !LM "OMPTER

    N!#ERS!TAS MSL!M!NDONES!A

    1

  • 7/17/2019 Format Dokumentasi

    2/28

    201$

    2

  • 7/17/2019 Format Dokumentasi

    3/28

    DAFTAR ISI

    3

  • 7/17/2019 Format Dokumentasi

    4/28

    Isi (Inti Pembahasan)

    1. Hello World

    Source Code

    package HelloWorld;

    /***

    * @author Ryan FA

    */

    public class Hel {

    public static void main!tring"# args${

    !ystem%out%println&Hello World%%%'& ( &)n+m Ryan ,-..,-.,.-$&$;

    0

    0

    Result

    Hello World%%%'

    +m Ryan ,-..,-.,.-$

    Information

    method println() digunakan untuk menampilkan text

    2. Tipe Data dan Variabel

    Source Code

  • 7/17/2019 Format Dokumentasi

    5/28

    package 1ipe2ata34ariabel;

    /**

    *

    * @author Ryan FA

    */

    public class Huh {

    public static void main !tring"#args${

    !tring nama 5 &Ryan&;

    !ystem%out%println&6ama7 &(nama$;

    0

    0

    Result

    6ama7 Ryan

    Information

    3. Konstanta dan Static

    Source Code

  • 7/17/2019 Format Dokumentasi

    6/28

    package Konstanta_Static;

    /**

    *

    * @author Ryan FA

    */

    public class Heh {

    public static double ipk;

    public static inal String !A"A_"HS # $Ryan Fadel Ah%ad$;

    public static &oid %ain'String() args{

    ipk # +,-.;

    Syste%,out,println'$"ahasisa berna%a $0!A"A_"HS0$ $;

    Syste%,out,println'$%e%punyai 12K $0ipk;

    3

    3

    Result

    8ahasis9a bernama Ryan Fadel Ahmad

    mempunyai : -%

  • 7/17/2019 Format Dokumentasi

    7/28

    package >perator;

    import ?ava%util%!canner;

    /**

    *

    * @author Ryan FA

    */

    public class Hai {

    public static void main !tring"#args${

    !canner input 5 ne9 !canner!ystem%in$;

    !ystem%out%print&8asukkan nilai7 &$;

    int masuk 5 input%netnt$;

    i masukB,.. CC masukD&$;

    0else i masukB5&$;

    0else

    !ystem%out%println&AW&$;

    0

    0

    Result

    8asukkan nilai7 G.

    E>

    Information

    5. Seleksi!"ercabangan

    Source Code

  • 7/17/2019 Format Dokumentasi

    8/28

    package :ercabangan;

    /**

    *

    * @author Ryan FA

    */

    public class Hui {

    public static void main!tring"# args${

    int annt 5 .;

    i annt55.$

    !ystem%out%println&4ariabel annt bernilai nol&$;

    else

    !ystem%out%println&4ariabel annt tidak bernilai nol&$;

    0

    0

    Result

    4ariabel annt bernilai nol

    Information

    6. "erulangan

    Source Code

  • 7/17/2019 Format Dokumentasi

    9/28

    package :erulangan;

    /**

    *

    * @author Ryan FA

    */

    public class Hoi {

    public static void main !tring"#args${

    int a 5 ,;

    do{

    !ystem%out%printa$;

    a((;

    09hileaB5$;

    0

    0

    Result

    ,-I=J

  • 7/17/2019 Format Dokumentasi

    10/28

    package Fungsi3Rekursi;

    import ?ava%util%!canner;

    /**

    *

    * @author Ryan FA

    */

    public class Hoe {

    public static void main !tring"#args${

    !canner input 5 ne9 !canner!ystem%in$;

    !ystem%out%print&Knter an inde or a Fibonacci number7 &$;

    int inde 5 input%netnt$;

    !ystem%out%println&1he Fibonacci number at inde &(inde(& is

    &(ibinde$$;

    0

    public static long iblong inde${

    i inde55.$

    return .;

    else i inde55,$

    return ,;

    else

    return ibindeL,$(ibindeL$;

    0

    0

    Result

    Knter an inde or a Fibonacci number7

    1he Fibonacci number at inde is ,

    Information

    8. &rra'

    Source Code

  • 7/17/2019 Format Dokumentasi

    11/28

    package Array;

    /**

    *

    * @author Ryan FA

    */

    public class Heo {

    public static void main !tring"#args${

    int "# deret 5 ne9 int "=#;

    deret".# 5 ;

    deret",# 5 I;

    deret"# 5 ,;

    deret"-# 5

  • 7/17/2019 Format Dokumentasi

    12/28

    package Strea%14;

    i%port 5a&a,io,*;

    /**

    *

    * @author Ryan FA

    */

    public class Hail {

    /**

    * @para% args

    */

    public static &oid %ain'String() args {

    6ueredReader data;

    2rint7riter hasil;

    double() angka # ne double(8999);

    int banyakAngka;

    try {

    data # ne 6ueredReader'ne FileReader'$data,dat$;

    3

    catch 'File!otFound:ception e {

    Syste%,out,println'$

  • 7/17/2019 Format Dokumentasi

    13/28

    try {

    data,close';

    3

    catch '14:ception {

    Syste%,out,println'$ine' =# null {

    angka(banyakAngka) # ?ouble,parse?ouble'baris;

    banyakAngka00;

    3

    or 'int i # banyakAngka8; i # 9; i

    hasil,println'angka(i);

    Syste%,out,println'$Selesai=$;

    3

    catch '14:ception e {

    Syste%,out,println'$Kesalahan baca/tulis$;

    3

    catch '!u%berFor%at:ception e {

    Syste%,out,println'$Kesalahan or%atB $ 0 e,get"essage';

    3

    catch '1nde4ut46ounds:ception e {

    Syste%,out,println'$

  • 7/17/2019 Format Dokumentasi

    14/28

    3

    catch '14:ception e {

    Syste%,out,println'$

  • 7/17/2019 Format Dokumentasi

    15/28

    package Kception;

    /**

    *

    * @author Ryan FA

    */

    public class 1esKception {

    public static void main !tring"#args${

    try{

    !ystem%out%printlnargs",#$;

    0catchArraynde>ut>MoundsKception e${

    !ystem%out%println&Kception Naught&$;

    0

    0

    0

    Result

    Kception Naught

    Information

    11. O*erriding dan O*erloading

    Source Code

    //oad%?ava

    package >verriding3>verloading;

  • 7/17/2019 Format Dokumentasi

    16/28

    /**

    *

    * @author Ryan FA

    */

    public class oad{

    public void tambah,${

    int a5=O b5,.;

    !ystem%out%println&Hasil :ertambahann dari metod tambah, keL, 5

    &(a(b$$;

    0

    public void tambah,int O int y${

    !ystem%out%println&Hasil :ertambahann dari metod tambah, keL 5 &(

    (y$$;

    0

    public void !apa${

    !ystem%out%println&Ryan Fadel Ahmad&$;

    0

    0

    //Ride%?ava

    package >verriding3>verloading;

    /**

    *

    * @author Ryan FA

    */

    public class Ride etends oad{

    @>verride

    public void !apa${

    !ystem%out%println&Amani 6urul husna&$;

    0

    0

    //main%?ava

  • 7/17/2019 Format Dokumentasi

    17/28

    package >verriding3>verloading;

    /**

    *

    * @author Ryan FA

    */

    public class 8ain {

    public static void main!tring "# args${

    oad pp;

    pp 5 ne9 oad$;

    pp%tambah,$;

    pp%tambah,=O=$;

    oad ss;

    Ride nn;

    ss 5 ne9 oad$;

    nn 5 ne9 Ride$;

    ss%!apa$;

    nn%!apa$;

    0

    0

    Result

    Hasil :ertambahann dari metod tambah, keL, 5 ,=

    Hasil :ertambahann dari metod tambah, keL 5 ,.

    Ryan Fadel Ahmad

    Amani 6urul husna

    Information

  • 7/17/2019 Format Dokumentasi

    18/28

    12. nter%ace dan &bstract +lass

    Source Code

    package nterace3Abstrak;

    /**

    *

    * @author Ryan FA

    */

    interace Mahan {

    !tring perunggu 5 &perunggu&;

    !tring emas 5 &emas&;

    !tring marmer 5 &marmer&;

    !tring perak 5 &perak&;

    !tring kayu 5 &kayu&;

    0

    abstract class Mahan>b?ect {

    !tring bahan;

    0

    class Mahan>b?ects {

    public static void main!tring args"#$ {

    Mola bola 5 ne9 MolaMahan%kayu$;

    oin koin 5 ne9 oinMahan%perak$;

    Nincin cincin 5 ne9 NincinMahan%emas$;

  • 7/17/2019 Format Dokumentasi

    19/28

    !ystem%out%printlnbola%bahan$;

    !ystem%out%printlnkoin%bahan$;

    !ystem%out%printlncincin%bahan$;

    0

    0

    class Mola etends Mahan>b?ect {

    Mola!tring bahan$ {

    this%bahan 5 bahan;

    0

    0

    class oin etends Mahan>b?ect {

    oin!tring bahan$ {

    this%bahan 5 bahan;

    0

    0

    class Nincin etends Mahan>b?ect{

    Nincin!tring bahan$ {

    this%bahan5bahan;

    0

    0

    Result

    kayu

    perak

    emas

    Information

  • 7/17/2019 Format Dokumentasi

    20/28

    13. ,a*a -eneric

    Source Code

    package PavaEeneric;

    /**

    *

    * @author Ryan FA

    */

    import ?ava%util%*;

    public class Eeneric{

    public static void main!tring args"#${

    ArrayistB!tringD list5ne9 ArrayistB!tringD$;

    list%add&rahul&$;

  • 7/17/2019 Format Dokumentasi

    21/28

    list%add&?ai&$;

    !tring s5list%get,$;//type casting is not reQuired

    !ystem%out%println&element is7 &(s$;

    teratorB!tringD itr5list%iterator$;

    9hileitr%has6et$${

    !ystem%out%printlnitr%net$$;

    0

    0

    0

    Result

    element is7 ?ai

    rahul

    ?ai

    Information

    14. ultithread dan Sinkronisasi

    Source Code

    Result

    Information

  • 7/17/2019 Format Dokumentasi

    22/28

    15. Struktur Data: StackSource Code

    package !tack;

    import ?ava%util%!canner;

    import ?ava%util%!tack;

    /**

    *

    * @author Ryan FA*/

    public class 6e9Nlass {

    static !tack en 5 ne9 !tack$;

    static !canner in 5 ne9 !canner!ystem%in$;

  • 7/17/2019 Format Dokumentasi

    23/28

    static !tring a;

    static !tring arr;

    static int ma3st;

    static int i5.;

    static int top 5L,;

    static void pushh!tack enO !tring a${

    en%pusha$%to!tring$$;

    !ystem%out%println&!tack7 & ( en$;

    0

    public int ind${

    return int$ top5top(,$;

    0

    static void popp!tack enO !tring a ${

    a 5 !tring$ en%pop$;

    !ystem%out%println&stack7 & ( en$;

    0

    public static void main!tring"# args$ {

    !ystem%out%print&8asukkan 8a3!tack 7 &$;

    ma3st5in%netnt$;

    or int i 5 .; i B ma3st; i(($ {

    !ystem%out%print&:S!H LD &$;

    a5in%net$;

    pushhenO a$;

    0

    !ystem%out%println&:>: 5 y / anykeys5stop&$;

    9hile'a%eQuals&n&$${

    !ystem%out%print&:>: LD &$;

    a5in%net$;

    i a%eQuals&y&$ CC 'en%isKmpty$$ {

    poppenO a$;

    0else{

    !ystem%out%println&apa stack kosongT &(en%isKmpty$$;

    break;

  • 7/17/2019 Format Dokumentasi

    24/28

    0

    !ystem%out%println&apa stack kosongT &(en%isKmpty$$;

    i en%isKmpty$$ {

    !ystem%out%println&stop&$;

    break;

    0

    0

    0

    0

    Result

    8asukkan 8a3!tack 7 I

    :S!H LD ,

    !tack7 ",#

    :S!H LD

    !tack7 ",O #

    :S!H LD -

    !tack7 ",O O -#

    :S!H LD I

    !tack7 ",O O -O I#

    :>: 5 y / anykeys5stop

    :>: LD y

    stack7 ",O O -#

    apa stack kosongT alse

    :>: LD y

    stack7 ",O #

    apa stack kosongT alse

    :>: LD y

    stack7 ",#

    apa stack kosongT alse

    :>: LD y

    stack7 "#

    apa stack kosongT true

    stop

    Information

  • 7/17/2019 Format Dokumentasi

    25/28

    16. ,a*a Socket

    Source Code

    Result

    Information

  • 7/17/2019 Format Dokumentasi

    26/28

    17. ,a*a &pplet

    Source Code

    Result

    Information

  • 7/17/2019 Format Dokumentasi

    27/28

    18. ,a*a S/ing

    Source Code

    Result

    Information

  • 7/17/2019 Format Dokumentasi

    28/28

    19. ,D0+

    Source Code

    Result

    Information