Kamis, 30 April 2015

Perbaikan Quiz 1 Ujian Online

Diposting oleh Borkat Lubis di 11.27
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UmmiThaharaniLubis;

import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import java.util.Date;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
 * @author LENOVO
 */
public class UjianOnlineMidlet extends MIDlet implements CommandListener {

    private Display disp;
    private Form fData, fSoal, fHasil;
    private TextField Nama = new TextField("Nama :", "", 50, TextField.ANY);
    private DateField TanggalLahir = new DateField("Tanggal Lahir :", DateField.DATE);
    private ChoiceGroup cgGender = new ChoiceGroup("Gender", Choice.EXCLUSIVE);
    private ChoiceGroup cgKelas = new ChoiceGroup("Pilihan Kelas", Choice.POPUP);
    private ChoiceGroup Soal1, Soal2, Soal3, Soal4, Soal5;
    private Command ExitCommand = new Command("Exit", Command.EXIT, 0);
    private Command MulaiCommand = new Command("Next", Command.SCREEN, 0);
    private Command BatalCommand = new Command("Back", Command.BACK, 0);
    private Command SelesaiCommand = new Command("Selesai", Command.SCREEN, 0);
    private StringItem sNama, sTanggal, sGender, sKelas;
    private String Nm, Tgl, Gen, Kls = null;
   
     public UjianOnlineMidlet() {
    }

    public Display getDisplay() {
        return Display.getDisplay(this);
    }
    public void startApp() {
        disp = Display.getDisplay(this);
        fData = new Form("Masukkan Data Anda");
        fData.append(Nama);
        fData.append(TanggalLahir);
        cgGender.append("Male", null);
        cgGender.append("Female", null);
        fData.append(cgGender);
        fData.append(cgKelas);
        cgKelas.append("2A", null);
        cgKelas.append("2B", null);
        cgKelas.append("2C", null);
        cgKelas.append("4A", null);
        cgKelas.append("4B", null);
        cgKelas.append("4C", null);
        cgKelas.append("6A", null);
        cgKelas.append("6B", null);
        fData.addCommand(ExitCommand);
        fData.addCommand(MulaiCommand);
        fData.setCommandListener(this);

        fSoal = new Form("Soal Ujian");
        Soal1 = new ChoiceGroup("Jelaskan pengertian malaikat...?", Choice.EXCLUSIVE);
        fSoal.append(Soal1);
        Soal1.append("malaikat adalah makhluk allah yang gaib diciptakan dari nur, Tugasnya mengabdi kepada Allah", null);
        Soal1.append("merupakan manusia yang nyata", null);
        Soal1.append("merupakan ruh yang tak berwujud", null);
        Soal1.append("merupakan masyarakat yang adil", null);
       

        Soal2 = new ChoiceGroup("Kapan Indonesia Merdeka...?", Choice.EXCLUSIVE);
        fSoal.append(Soal2);
        Soal2.append(" 12 Januari 1945", null);
        Soal2.append(" 18 September 2000", null);
        Soal2.append(" 20 Juli 2007", null);
        Soal2.append(" 17 Agustus 1945", null);

        Soal3 = new ChoiceGroup("Berapa jumlah Nabi dan Rasuluallah...?", Choice.EXCLUSIVE);
        fSoal.append(Soal3);
        Soal3.append("15", null);
        Soal3.append("100", null);
        Soal3.append("25", null);
        Soal3.append("11", null);

        Soal4 = new ChoiceGroup("Siapakah Presiden kita Sekarang...?", Choice.EXCLUSIVE);
        fSoal.append(Soal4);
        Soal4.append("Susilo", null);
        Soal4.append("Soekarno", null);
        Soal4.append("Jokowi", null);
        Soal4.append("Megawati", null);

        Soal5 = new ChoiceGroup("Berapakah jumlah  Juz dalam  Al-qur'an...?", Choice.EXCLUSIVE);
        fSoal.append(Soal5);
        Soal5.append("10 Juz", null);
        Soal5.append("30 Juz", null);
        Soal5.append("11 Juz", null);
        Soal5.append("9 Juz", null);
        fSoal.addCommand(BatalCommand);
        fSoal.addCommand(SelesaiCommand);
        fSoal.setCommandListener(this);

     
        fHasil=new Form ("Report Anda");
        sNama=new StringItem ("Nama :",null);
        sTanggal=new StringItem ("Tanggal Lahir :",null);
        sGender=new StringItem ("Gender :",null);
        sKelas=new StringItem ("Kelas :",null);
        fHasil.append(sNama);
        fHasil.append(sTanggal);
        fHasil.append(sGender);
        fHasil.append(sKelas);
        fHasil.addCommand(ExitCommand);
        fHasil.setCommandListener(this);
         disp.setCurrent(fData);
    }
   

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
   
    }
   public void commandAction(Command c, Displayable d) {
        if (c == ExitCommand)
            { //jika tombol/command Exit ditekan
            destroyApp(true);
            notifyDestroyed();
          }    else if (c==MulaiCommand){
                if (d==fData){
                    disp.setCurrent(fSoal);
                }
                } else if (c == BatalCommand) {
            disp.setCurrent(fData);
                }
                else if(c==SelesaiCommand)
         {
                Nm = Nama.getString();
                Tgl= TanggalLahir.getDate().toString();
                Gen= cgGender.getString(cgGender.getSelectedIndex());
                Kls= cgKelas.getString(cgKelas.getSelectedIndex());
                sNama.setText(Nm);
                sTanggal.setText(Tgl);
                sGender.setText(Gen);
                sKelas.setText(Kls);
                disp.setCurrent(fHasil);

       
        }
    }
}

0 komentar:

Posting Komentar

 

Ummi Thaharani Lubis Copyright © 2010 Design by Ipietoon Blogger Template Graphic from Enakei