aplikasi mobile bookstore

Upload: ayututut

Post on 07-Apr-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Aplikasi Mobile Bookstore

    1/15

    Aplikasi Mobile Bookstore

    LaporanTugasBesar Mobile Programming

    Diajukanuntukmemenuhitugasmatakuliah Mobile Pogramming pada semester V jurusanTeknikInformatika

    Oleh :

    Nana Supriatna 1073104

    RizkiPratamaPutri 1073102

    DIPLOMA III TEKNIK INFORMATIKAPOLITEKNIK POS INDONESIA

    BANDUNG2010

  • 8/6/2019 Aplikasi Mobile Bookstore

    2/15

    1. Pendahuluan

    A plikasi Mobile Bookstore inidibuatdengankonsep client-server,

    dimanaaplikasi client digunakanuntukmengakses data dariaplikasi

    server.Pembuatanaplikasi client, yang merupakanaplikasi yang dipasang di mobile

    phone atauponseldibangunmenggunakan J2ME danaplikasi yang merupakanhalaman

    admin Mobile Bookstore dibangunmenggunakan JSP.Keduanyamenggunakan

    database MySQL.

    A plikasiinidibangununtukmemudahkanpelanggansebuahtokobukudalammenac

    ribuku yang ingindibeli. A plikasiiniakanditanam di ponselpegawaisebuahtokobuku,

    sehinggapelanggantidakharusmengunjungikasiratau pc untukmencarijudulbuku yang

    akanmerekabeli.

    A plikasi client berisiinformasitentangbukuterbaru, bukuterlaris, info

    hargabuku, info bukudaripengarangtertentu yang ingin di cari.Sedangkanhalaman

    admin digunakan admin untukmengelola data bukusecara detail yang akanditampilkan

    di aplikasi client.

    2. IdentifikasiMasalah

    a. Pelangganharusmendatangikasiratau information center

    apabilainginmengatahuiinfobuku yang akandibelinya.

    b. Pegawaitidakbisamenjawabpertanyaanpelanggansecaralangsung.

    c. Data yang ditampilkankuranglengkap.

    3. Tujuan

    a. Untukmemudahkanpelanggandalammencariinformasitentangbuku yang

    akanmerekabeli.

    b. Untukmemudahkanpegawaitokobukudalammenjawabpertanyaanpelanggan yang

    inginmencarisebuahbuku.

    c. Untukmengoptimalkanfungsiponsel yang sudahsemakinberkembang.

  • 8/6/2019 Aplikasi Mobile Bookstore

    3/15

  • 8/6/2019 Aplikasi Mobile Bookstore

    4/15

    5 . SkenarioAplikasi Mobile Bookstore

    Skenario dari aplikasi ini secara umum adalah :

    1. A plikasi menampilakan halaman utama .

    2. Setelah user meng-klik GO.

    3. Sistem akan menampilkan halaman menu utama.

    4. Jika kita sudah terdaftar kita dapat langsung memilih menu masuk, tetapi jika kita

    belum terdaftar kita harus memilih menu daftar dan mendaftarkan diri kita terlebih

    dahulu.

    5. Lalu kita login untuk dapat mengakses menu user.

    6. Dalam menu user kita dapat melihat data buku terbaru, data buku terlaris, data buku

    oleh pengarang tertentu, data buku dengan penerbit tertentu.

    Skenario secara detail dari A plikasi Mobile Bookstore sebagai berikut:

    y Tema : Mobile A plicationy User :

    o User (pengguna): Pengguna mobile (handphone), pegawaitokobuku.

    o Menu utama: Login Daftar

    Bantuan Tentang Kami Keluar

    o Menu User : Info BukuTerbaru Info DeskripsiBuku Info HargaBuku Info BukuTerlaris Info BukuPengarangTertentu Info BukuPenerbitTertentu

    o A kses user : A plikasiakanmenampilkan data bukuterbaru A plikasiakanmenampilkan data bukuterlaris A plikasiakanmenampilakan data bukudaripenerbittertentu A plikasiakanmenampilkan data bukudaripengarangtertentu

  • 8/6/2019 Aplikasi Mobile Bookstore

    5/15

    6 . Use Case

    a. Use Case Aplikasi Mobile Bookstore

    System

    User

    Halaman Utama

    Masuk

    Daftar

    Bantuan

    Tentang Kami

    Keluar

    Info buku terbaru

    Info Deskripsi terbaru

    Info harga buku

    Info buku terlaris

    Info buku penerbit tertentu

    Info buku pengarang te rtentu

    Isi Form

    Tata cara pangunaan aplikasi

    Tentang aplikasi Mobile Bookstore

  • 8/6/2019 Aplikasi Mobile Bookstore

    6/15

    b. Use Case Halaman Admin

    7.

    Listing ProgramTampilanAwal

    package mbook;

    importjavax.microedition.lcdui.*;import main. A ppBookStore;

    public class Tampilan_ A wal extends Form implements CommandListener {

    private m_BS BS; private Display display;

    ImageItemimage_BS;

    public Tampilan_ A wal(Display display, m_BS BS) {

    super("Mobile Book Store Information System");this.display = display;

    this.BS = BS;try {

    Tampil();} catch(Exception e) {

    e.printStackTrace();}

    }

    System

    Admin

    Halaman Admin Login

    Home

    Insert

    Update

    Buku

    >

    >

    >

    >

    Logout

    >

  • 8/6/2019 Aplikasi Mobile Bookstore

    7/15

    public Tampilan_ A wal( A ppBookStoreaThis, Display display) {super("Mobile Book Store Information System");

    this.display = display;this.display = display;

    try {Tampil();

    } catch(Exception e) {

    e.printStackTrace();}}

    private void Tampil() throws Exception {

    String s1 = "SelamatDatang di M-Book Store Information System.A ndaakanmendapatkanlayananmenarikdengantarifkompetitifbersama kami.";this.append(s1);

    image_BS = new ImageItem("", Image.createImage("mbook/img/BookStore.PNG"),ImageItem.L AY OUT_CENTER, "");this.append(image_BS);

    String s2 = "Silahkantekantombol [GO] untukmasukke program utama ... ";this.append(s2);

    addCommand(new Command(" GO ", Command.OK, 1));setCommandListener(this);

    } public void command A ction(Command command, Displayable displayable) {

    if (command.getLabel()== " GO ") {Menu_Utamamenu_utama = new Menu_Utama(display, BS);display.setCurrent(menu_utama);

    }}

    }

    Menu Utama package mbook;

    importjavax.microedition.lcdui.*;

    public class Menu_Utama extends List implements CommandListener{

    private Command cancel; private Command Cmd_Login; private Display display; private m_BS BS;String akhir;Ticker tkrMain;

    public Menu_Utama(Display display, m_BS BS) {super ("Menu Utama",List.IMPLICIT);

    this.display = display;this.BS = BS;

    try {tampilan();

  • 8/6/2019 Aplikasi Mobile Bookstore

    8/15

    } catch(Exception e) {e.printStackTrace();

    }}

    private javax.microedition.lcdui.Tickerget_tkrMain() {if (tkrMain == null) {

    tkrMain = new javax.microedition.lcdui.Ticker("Mobile Book Store Information System");}return tkrMain;

    }

    private void tampilan() throws Exception {

    setTicker(get_tkrMain());cancel = new Command("Keluar", Command.EXIT, 3);

    Cmd_Login = new Command("Pilih", Command.OK, 1);addCommand(cancel);addCommand(Cmd_Login);

    Image a = null;Image b = null;Image c = null;Image d = null;Image e = null;

    try {a = Image.createImage("mbook/img/user.png");

    b = Image.createImage("mbook/img/daftar.png");c = Image.createImage("mbook/img/help.png");d = Image.createImage("mbook/img/info.png");e = Image.createImage("mbook/img/exit.png");

    }catch (Exception f) { }append(" Masuk",a);append(" Daftar",b);append(" Bantuan",c);append(" TentangKami",d);append(" Keluar",e);

    setCommandListener(this);} public void command A ction(Command c, Displayable d) {

    if (c.getLabel().equals("Keluar")) {m_BS.quit A pp();

    }else {

    intselectedIndex = getSelectedIndex();try {

    if (selectedIndex == 0) {Login_Userlogin_user = newLogin_User(display, BS);display.setCurrent(login_user);

    }else if (selectedIndex == 1) {

    Daftar_Userdaftar_user = newDaftar_User(display, akhir);display.setCurrent(daftar_user);

    }

  • 8/6/2019 Aplikasi Mobile Bookstore

    9/15

    if (selectedIndex == 2) {Help bantuan = new Help(display, BS);

    display.setCurrent(bantuan);}

    else if (selectedIndex == 3) {A bout about = new A bout(display, BS);

    display.setCurrent(about);

    } else if (selectedIndex == 4) {Tampilan_ A walkeluar = new Tampilan_ A wal(display, BS);display.setCurrent(keluar);

    }

    }catch (Exception e) {

    A lert a = new A lert("TerjadiKesalahan : ");a.setString("Gagal me-load pilihan : " +getString(selectedIndex));a.setTimeout(2000);display.setCurrent(a);

    }}}

    }

    Daftar User package mbook;

    importjavax.microedition.lcdui.*;import javax.microedition.io.*;

    import java.io.*;

    public class Daftar_User extends Form implements CommandListener {

    private Display display; private StringItemHasilItem;

    private TextField user; private TextFieldalamat; private TextFieldnoktp; private TextFieldtelp; private TextFieldpasswd;

    private Form form_hasil; private String result, akhir1; private m_BS BS;

    public Daftar_User(Display display, String akhir) {

    super("Form Pendaftaran");this.display = display;

    this.akhir1 = akhir1;this.form_hasil = form_hasil;

    form_hasil = new Form("Pendaftaran");HasilItem = new StringItem("","");form_hasil.append(HasilItem);

  • 8/6/2019 Aplikasi Mobile Bookstore

    10/15

    try {

    jbInit();}catch(Exception e) {

    e.printStackTrace();}

    } private void jbInit() throws Exception {

    user = new TextField("", "", 64,TextField. A NY );user.setLabel("Nama : ");this.append(user);

    alamat = new TextField("", "", 25,TextField. A NY );alamat.setLabel(" A lamat : ");this.append(alamat);

    noktp = new TextField("", "", 15,TextField. A NY );noktp.setLabel("No. KTP : ");

    this.append(noktp);

    telp = new TextField("", "", 16,TextField. A NY );telp.setLabel("No. Telp : ");this.append(telp);

    passwd = new TextField("", "", 64, TextField.P A SSWORD); passwd.setLabel("Password : ");this.append(passwd);

    addCommand(new Command("Back", Command.B A CK, 2));addCommand(new Command("OK", Command.OK, 1));

    setCommandListener(this);

    Command ok = new Command("OK",Command.B A CK,2);form_hasil.addCommand(ok);

    form_hasil.setCommandListener(this);

    }

    public void command A ction(Command c, Displayable d) {

    if (c.getCommandType() == Command.B A CK) {Menu_Utamamenu_utama = new Menu_Utama(display, BS);display.setCurrent(menu_utama);

    }else if (c.getCommandType() == Command.OK) {

    String akhir1 = InputData(user.getString(),alamat.getString(),noktp.getString(),telp.getString(),passwd.getString());display.setCurrent(form_hasil);

    }

    else if (c.getLabel().equals("OK")) {Menu_Utamamenu_utama = new Menu_Utama(display, BS);

    display.setCurrent(menu_utama);

  • 8/6/2019 Aplikasi Mobile Bookstore

    11/15

  • 8/6/2019 Aplikasi Mobile Bookstore

    12/15

    private String result,akhir;

    public Login_User(Display display, m_BS BS) {

    super("Login Pengguna");this.display = display;

    this.BS = BS;

    this.akhir = akhir;HasilItem = new StringItem("","");

    try {Tampil();

    }catch(Exception e) {

    e.printStackTrace();}

    }

    public void Tampil() throws Exception {

    user = new TextField("NamaPengguna : ", "", 25, TextField.A

    NY

    ); passwd = new TextField("Password : ", "", 30, TextField.P A SSWORD);Cmd_Back = new Command("Back", Command.B A CK, 2);Cmd_Login = new Command("Login", Command.OK, 1);

    append(user);append(passwd);

    addCommand(Cmd_Back);addCommand(Cmd_Login);setCommandListener(this);

    } public void command A ction(Command c, Displayable d) {

    if (c.getLabel().equals("Back")) {Menu_Utamamenu_utama = new Menu_Utama(display, BS);display.setCurrent(menu_utama);

    }else if (c.getLabel() == null ? "Login" == null : c.getLabel().equals("Login")) {

    String akhir1 = readData(user.getString(), passwd.getString());

    if (akhir1.equals("Salah") == true) {m_BS.show A lert("Login Ditolak !");

    }else{Menu_UserMenu_User = new Menu_User(display,akhir1);display.setCurrent(Menu_User);

    }}

    } private String readData(String user, String passwd) {

    StreamConnection conn = null;InputStream in = null;StringBuffer data = new StringBuffer();

    try {conn = (StreamConnection)Connector.open("http://localhost/m-

    BS/mobile/login.php?user="+user+"&passwd="+passwd);in = conn.openInputStream();

  • 8/6/2019 Aplikasi Mobile Bookstore

    13/15

    intch;

    while((ch=in.read())!=-1) {if (ch!='\t'){

    data.append((char)ch);result = data.toString();

    }else {

    HasilItem.setText(data.toString());data = new StringBuffer();}

    }}catch( IOException e) {

    System.err.println("Sistemtidakstabil");}return result;

    }}

    Menu User package mbook;

    importjavax.microedition.lcdui.*;

    public class Menu_User extends List implements CommandListener { private Command Cmd_Back; private Command Cmd_Login; private Display display; private m_BS BS;String akhir;

    public Menu_User(Display display,Stringakhir) {super("Menu User", List.IMPLICIT) ;

    this.display = display;this.BS = BS;

    this.akhir = akhir;

    try {Tampilan_ A wal();

    }catch(Exception e) {

    e.printStackTrace();}

    }

    private void Tampilan_ A wal() throws Exception {Cmd_Back = new Command("Back", Command.B A CK, 2);Cmd_Login = new Command("Pilih", Command.OK, 1);addCommand(Cmd_Back);addCommand(Cmd_Login);

    Image a = null;Image b = null;Image b1 = null;Image b2 = null;Image c = null;Image d = null;

    try {

  • 8/6/2019 Aplikasi Mobile Bookstore

    14/15

    a = Image.createImage("mbook/img/1.gif"); b = Image.createImage("mbook/img/2.gif"); b1 = Image.createImage("mbook/img/3.gif"); b2 = Image.createImage("mbook/img/4.gif");c = Image.createImage("mbook/img/5.gif");d = Image.createImage("mbook/img/6.gif");

    }

    catch (Exception f) { }append("Info BukuTerbaru",a);append("Info DeskripsiBuku",b);append("Info Harga Buku",b1);append("Info Buku Terlaris",b2);append("Info Buku - PenerbitTertentu",c);append("Info Buku - PengarangTertentu",d);

    setCommandListener(this);}

    public void command A ction(Command e, Displayable f) {if (e.getCommandType() == Command.B A CK) {

    Menu_Utamamenu_utama = new Menu_Utama(display, BS);display.setCurrent(menu_utama);

    }else {intselectedIndex = getSelectedIndex();

    try {if (selectedIndex == 0) {

    Info_Terbaruinfo_terbaru = newInfo_Terbaru(display,akhir);display.setCurrent(info_terbaru);

    }else if (selectedIndex == 1) {

    Info_Deskripsiinfo_deskripsi = newInfo_Deskripsi(display,akhir);display.setCurrent(info_deskripsi);

    }else if (selectedIndex == 2) {

    Info_Hargainfo_harga = newInfo_Harga(display,akhir);display.setCurrent(info_harga);

    }else if (selectedIndex == 3) {

    Info_Terlarisinfo_terlaris = newInfo_Terlaris(display,akhir);display.setCurrent(info_terlaris);

    }else if (selectedIndex == 4) {

    Info_Penerbitinfo_penerbit = newInfo_Penerbit(display,akhir);display.setCurrent(info_penerbit);

    }else if (selectedIndex == 5) {

    Info_Pengaranginfo_pengarang = newInfo_Pengarang(display,akhir);display.setCurrent(info_pengarang);

    }}

    catch (Exception g) {A lert a = new A lert("Error");

    a.setString("Gagal me-load menu : " + getString(selectedIndex));a.setTimeout(2000);

  • 8/6/2019 Aplikasi Mobile Bookstore

    15/15

    display.setCurrent(a);}

    }}

    }

    8 . Implementasi

    Tampilan A wal Main Menu Daftar User

    Masuk Menu Utama Info BukuTerbaru