import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.*;
public class pertemuanuts extends MIDlet implements CommandListener{
Form f = new Form("UTS Komputasi Bergerak");
TextField angka1 = new TextField("Angka 1", "", 5, TextField.NUMERIC);
TextField angka2 = new TextField("Angka 2", "", 5, TextField.NUMERIC);
TextField hasil = new TextField("Angka 3", "", 10, TextField.NUMERIC);
Command b_hitung = new Command("Hitung", Command.OK, 0);
public void startApp() {
f.append(angka1);
f.append(angka2);
f.append(hasil);
f.addCommand(b_hitung);
f.setCommandListener(this);
Display.getDisplay(this).setCurrent(f);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if(c == b_hitung){
int a1 = Integer.parseInt(angka1.getString());
int a2 = Integer.parseInt(angka2.getString());
int z = a1 / a2;
hasil.setString(String.valueOf(z));
}
}
}