/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class HotelMidlet
extends MIDlet
implements CommandListener {
private static final String kJenisKamar = "Jenis Kamar";
private static final String kTambahan = "Tambahan Fasilitas Kamar";
private static final String kTanggal = "Tanggal Meningap";
private static final String kTotal = "Total";
private static final String kExit = "Exit";
private Display mDisplay;
private List mMainList, mJenisKamar, mTambahan;
private TextField tCheckIn = new TextField("Tanggal Check In (Hari/Bulan/Tahun):", "", 30, TextField.ANY);
private TextField tCheckOut = new TextField("Tanggal Check Out(Hari/Bulan/Tahun):", "", 30, TextField.ANY);
private Form total, Tanggal;
private Command mOKCommand;
public void startApp() {
if (mMainList == null) {
mMainList = new List("Pemesanan Kamar Hotel", List.IMPLICIT);
Image entreeImage = null;
Image toppingsImage = null;
Image exitImage = null;
try {
entreeImage = Image.createImage("/entrees.png");
toppingsImage = Image.createImage("/toppings.png");
exitImage = Image.createImage("/exit.png");
} catch (java.io.IOException ioe) {
} catch (Exception e) {
}
mMainList.append(kTanggal, exitImage);
mMainList.append(kJenisKamar, entreeImage);
mMainList.append(kTambahan, toppingsImage);
mMainList.append(kTotal, null);
mMainList.append(kExit, exitImage);
mMainList.setCommandListener(this);
mOKCommand = new Command("OK", Command.OK, 0);
Tanggal = new Form("Tanggal Check In & Check Out");
Tanggal.append(tCheckIn);
Tanggal.append(tCheckOut);
Tanggal.addCommand(mOKCommand);
Tanggal.setCommandListener(this);
mJenisKamar =
new List("Pilih Jenis Kamar", List.EXCLUSIVE);
mJenisKamar.append("Presidental Room with Nature View, Double Bed", null);
mJenisKamar.append("Presidental Room, Double Bed", null);
mJenisKamar.append("Suite Room, Double Bed", null);
mJenisKamar.append("Suite Room, Twin Bed", null);
mJenisKamar.append("Deluxe Room, Double Bed", null);
mJenisKamar.append("Deluxe Room, Twin Bed", null);
mJenisKamar.append("Standard Room, Twin Bed", null);
mJenisKamar.append("Standard Room, Single Bed", null);
mJenisKamar.addCommand(mOKCommand);
mJenisKamar.setCommandListener(this);
mTambahan =
new List("Pilih Pelayanan Kamar", List.MULTIPLE);
mTambahan.append("Breakfast in Bed", null);
mTambahan.append("Fitness centre", null);
mTambahan.append("Laundry & Dry Cleaning", null);
mTambahan.append("Golf Driving Range", null);
mTambahan.append("Standard Spa Package", null);
mTambahan.append("Deluxe Spa Package", null);
mTambahan.append("Deluxe Spa Package + Massage", null);
mTambahan.addCommand(mOKCommand);
mTambahan.setCommandListener(this);
mDisplay = Display.getDisplay(this);
}
mDisplay.setCurrent(mMainList);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == List.SELECT_COMMAND && d == mMainList) {
int actionIndex = mMainList.getSelectedIndex();
if (actionIndex < 0) {
return;
}
String action = mMainList.getString(actionIndex);
if (action.equals(kExit)) {
destroyApp(true);
notifyDestroyed();
} else if (action.equals(kTanggal)) {
mDisplay.setCurrent(Tanggal);
} else if (action.equals(kJenisKamar)) {
mDisplay.setCurrent(mJenisKamar);
} else if (action.equals(kTambahan)) {
mDisplay.setCurrent(mTambahan);
} else if (action.equals(kTotal)) {
String selection = mJenisKamar.getString(mJenisKamar.getSelectedIndex());
boolean selected[] = new boolean[mTambahan.size()];
mTambahan.getSelectedFlags(selected);
total = new Form("Total");
total.append("Tanggal Check In:");
total.append(tCheckIn.getString() + " ");
total.append("Tanggal Check Out:");
total.append(tCheckOut.getString() + " ");
total.append("Jenis Kamar:");
total.append(selection + " ");
total.append("Tambahan:");
for (int i = 0; i < mTambahan.size(); i++) {
total.append(mTambahan.getString(i) + (selected[i] ? "(dipesan)" : "(tidak dipesan)"));
}
total.addCommand(mOKCommand);
total.setCommandListener(this);
mDisplay.setCurrent(total);
}
} else if (c == mOKCommand) {
mDisplay.setCurrent(mMainList);
}
}
}
All About Me
Sabtu, 18 April 2015
Jumat, 17 April 2015
Sending Message
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.*;
public class SendingMessage extends MIDlet implements CommandListener, Runnable {
private Display display;
private Command cmdKeluar, cmdLanjut, cmdKembali, cmdKirim;
private Displayable prevScreen;
private TextBox tfNum, tfText;
private String port;
private Thread thread;
private Alert alert;
private final String INVALID_PHONE =
"Nomor yang dimasukkan tidak absah";
public SendingMessage() {
display = Display.getDisplay(this);
port = getAppProperty("Port-SMS");
cmdKeluar = new Command("Keluar", Command.EXIT, 1);
cmdLanjut = new Command("Lanjut", Command.SCREEN, 1);
cmdKembali = new Command("Kembali", Command.BACK, 1);
cmdKirim = new Command("Kirim", Command.SCREEN, 1);
alert = new Alert(null);
alert.setTimeout(3000);
}
public void startApp() {
tfNum = generatePhoneInput();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar) {
destroyApp(false);
notifyDestroyed();
} else if (c == cmdKembali) {
display.setCurrent(tfNum);
} else if (c == cmdLanjut) {
if (!isValidPhoneNumber(tfNum.getString())) {
alert.setType(AlertType.ERROR);
alert.setString(INVALID_PHONE);
display.setCurrent(alert, tfNum);
} else {
tfText = generateMessageInput();
}
} else {
thread = new Thread((java.lang.Runnable) this);
thread.start();
}
}
public void run() {
MessageConnection conn = null;
String alamat = "sms://" + tfNum.getString() + ":" + port;
try {
conn = (MessageConnection) Connector.open(alamat);
TextMessage pesan = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
pesan.setAddress(alamat);
pesan.setPayloadText(tfText.getString());
conn.send(pesan);
alert.setString("Sedang mengirim ke nomoe" + alamat.substring(6));
alert.setType(AlertType.INFO);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
private TextBox generatePhoneInput() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private boolean isValidPhoneNumber(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private TextBox generateMessageInput() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.*;
public class SendingMessage extends MIDlet implements CommandListener, Runnable {
private Display display;
private Command cmdKeluar, cmdLanjut, cmdKembali, cmdKirim;
private Displayable prevScreen;
private TextBox tfNum, tfText;
private String port;
private Thread thread;
private Alert alert;
private final String INVALID_PHONE =
"Nomor yang dimasukkan tidak absah";
public SendingMessage() {
display = Display.getDisplay(this);
port = getAppProperty("Port-SMS");
cmdKeluar = new Command("Keluar", Command.EXIT, 1);
cmdLanjut = new Command("Lanjut", Command.SCREEN, 1);
cmdKembali = new Command("Kembali", Command.BACK, 1);
cmdKirim = new Command("Kirim", Command.SCREEN, 1);
alert = new Alert(null);
alert.setTimeout(3000);
}
public void startApp() {
tfNum = generatePhoneInput();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar) {
destroyApp(false);
notifyDestroyed();
} else if (c == cmdKembali) {
display.setCurrent(tfNum);
} else if (c == cmdLanjut) {
if (!isValidPhoneNumber(tfNum.getString())) {
alert.setType(AlertType.ERROR);
alert.setString(INVALID_PHONE);
display.setCurrent(alert, tfNum);
} else {
tfText = generateMessageInput();
}
} else {
thread = new Thread((java.lang.Runnable) this);
thread.start();
}
}
public void run() {
MessageConnection conn = null;
String alamat = "sms://" + tfNum.getString() + ":" + port;
try {
conn = (MessageConnection) Connector.open(alamat);
TextMessage pesan = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
pesan.setAddress(alamat);
pesan.setPayloadText(tfText.getString());
conn.send(pesan);
alert.setString("Sedang mengirim ke nomoe" + alamat.substring(6));
alert.setType(AlertType.INFO);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
private TextBox generatePhoneInput() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private boolean isValidPhoneNumber(String string) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
private TextBox generateMessageInput() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
Recieve Message
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.MessageListener;
import javax.wireless.messaging.TextMessage;
public class RecieveMessage extends MIDlet
implements CommandListener, Runnable, MessageListener {
private Display display;
private Alert alert;
private TextBox tfPesan;
private Thread thread;
private MessageConnection conn;
private Message pesan;
private String[] daftarKoneksi;
private boolean selesaiProses;
private String port;
private final Command cmdKeluar = new Command("Keluar", Command.EXIT, 1);
public RecieveMessage() {
port = getAppProperty("Port-SMS");
display = Display.getDisplay(this);
alert = new Alert("Terima SMS");
alert.setTimeout(Alert.FOREVER);
alert.addCommand(cmdKeluar);
alert.setCommandListener(this);
tfPesan = new TextBox(null, null, 500, TextField.ANY);
tfPesan.addCommand(cmdKeluar);
tfPesan.setCommandListener(this);
}
public void startApp() {
String alamatKoneksi = "sms://:" + port;
if (conn == null) {
try {
conn = (MessageConnection) Connector.open(alamatKoneksi);
conn.setMessageListener(this);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
daftarKoneksi = javax.microedition.io.PushRegistry.listConnections(true);
if (daftarKoneksi == null || daftarKoneksi.length== 0) {
alert.setString("Menunggu SMS pada port" + port + "...");
}
startNewThread();
display.setCurrent(alert);
}
public void pauseApp() {
selesaiProses = true;
thread = null;
}
public void destroyApp(boolean unconditional) {
selesaiProses = true;
thread = null;
if (conn != null) {
try {
conn.close();
} catch (IOException e) {
}
}
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar || c == Alert.DISMISS_COMMAND) {
destroyApp(false);
notifyDestroyed();
}
}
// method ini ada karena kia mengimplementasikan
// interface Runnable
public void run() {
try {
pesan = conn.receive();
if (pesan != null) {
String alamatPengirim = pesan.getAddress();
tfPesan.setTitle("Pesan dari:" + alamatPengirim.substring(6));
if (pesan instanceof TextMessage) {
TextMessage pesanTeks = (TextMessage) pesan;
tfPesan.setString(pesanTeks.getPayloadText());
}
display.setCurrent(tfPesan);
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
// method ini ada karena kita mengimplementasikan
// interface MessageListener
public void notifyIncomingMessage(MessageConnection conn) {
if (thread == null) {
startNewThread();
}
}
public void startNewThread() {
selesaiProses = false;
thread = new Thread(this);
thread.start();
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.MessageListener;
import javax.wireless.messaging.TextMessage;
public class RecieveMessage extends MIDlet
implements CommandListener, Runnable, MessageListener {
private Display display;
private Alert alert;
private TextBox tfPesan;
private Thread thread;
private MessageConnection conn;
private Message pesan;
private String[] daftarKoneksi;
private boolean selesaiProses;
private String port;
private final Command cmdKeluar = new Command("Keluar", Command.EXIT, 1);
public RecieveMessage() {
port = getAppProperty("Port-SMS");
display = Display.getDisplay(this);
alert = new Alert("Terima SMS");
alert.setTimeout(Alert.FOREVER);
alert.addCommand(cmdKeluar);
alert.setCommandListener(this);
tfPesan = new TextBox(null, null, 500, TextField.ANY);
tfPesan.addCommand(cmdKeluar);
tfPesan.setCommandListener(this);
}
public void startApp() {
String alamatKoneksi = "sms://:" + port;
if (conn == null) {
try {
conn = (MessageConnection) Connector.open(alamatKoneksi);
conn.setMessageListener(this);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
daftarKoneksi = javax.microedition.io.PushRegistry.listConnections(true);
if (daftarKoneksi == null || daftarKoneksi.length== 0) {
alert.setString("Menunggu SMS pada port" + port + "...");
}
startNewThread();
display.setCurrent(alert);
}
public void pauseApp() {
selesaiProses = true;
thread = null;
}
public void destroyApp(boolean unconditional) {
selesaiProses = true;
thread = null;
if (conn != null) {
try {
conn.close();
} catch (IOException e) {
}
}
}
public void commandAction(Command c, Displayable s) {
if (c == cmdKeluar || c == Alert.DISMISS_COMMAND) {
destroyApp(false);
notifyDestroyed();
}
}
// method ini ada karena kia mengimplementasikan
// interface Runnable
public void run() {
try {
pesan = conn.receive();
if (pesan != null) {
String alamatPengirim = pesan.getAddress();
tfPesan.setTitle("Pesan dari:" + alamatPengirim.substring(6));
if (pesan instanceof TextMessage) {
TextMessage pesanTeks = (TextMessage) pesan;
tfPesan.setString(pesanTeks.getPayloadText());
}
display.setCurrent(tfPesan);
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
// method ini ada karena kita mengimplementasikan
// interface MessageListener
public void notifyIncomingMessage(MessageConnection conn) {
if (thread == null) {
startNewThread();
}
}
public void startNewThread() {
selesaiProses = false;
thread = new Thread(this);
thread.start();
}
}
Sabtu, 04 April 2015
Tugas Sabtu, 4 April 2015 Java Mobile
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Novi Triana
*/
public class HMidlet extends MIDlet
implements CommandListener {
Display disp;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command page1 = new Command("Page 1", Command.SCREEN, 1);;
private Command page2 = new Command("Page 2", Command.SCREEN, 1);
private Command page3 = new Command("Page 3", Command.SCREEN, 1);
private Command home = new Command("Home", Command.SCREEN, 1);
public void startApp() {
Form formHome = new Form("Home");
formHome.append("Welcome to State Polytechnic of Medan Official Page");
formHome.addCommand(exitCommand);
formHome.addCommand(page1);
formHome.addCommand(page2);
formHome.addCommand(page3);
formHome.setCommandListener(this);
Display.getDisplay(this).setCurrent(formHome);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
} else if (c == page1) {
Form formPage1 = new Form("Page 1");
formPage1.append("This is page 1");
formPage1.addCommand(home);
formPage1.addCommand(page2);
formPage1.addCommand(page3);
formPage1.addCommand(exitCommand);
formPage1.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage1);
} else if (c == page2) {
Form formPage2 = new Form("Page 2");
formPage2.append("This is page 2");
formPage2.addCommand(home);
formPage2.addCommand(page1);
formPage2.addCommand(page3);
formPage2.addCommand(exitCommand);
formPage2.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage2);
} else if (c == page3) {
Form formPage3 = new Form("Page 3");
formPage3.append("This is page 3");
formPage3.addCommand(home);
formPage3.addCommand(page1);
formPage3.addCommand(page2);
formPage3.addCommand(exitCommand);
formPage3.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage3);
} else if (c == home) {
startApp();
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package triana.novi.midlet;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Novi Triana
*/
public class HMidlet extends MIDlet
implements CommandListener {
Display disp;
private Command exitCommand = new Command("Exit", Command.EXIT, 1);
private Command page1 = new Command("Page 1", Command.SCREEN, 1);;
private Command page2 = new Command("Page 2", Command.SCREEN, 1);
private Command page3 = new Command("Page 3", Command.SCREEN, 1);
private Command home = new Command("Home", Command.SCREEN, 1);
public void startApp() {
Form formHome = new Form("Home");
formHome.append("Welcome to State Polytechnic of Medan Official Page");
formHome.addCommand(exitCommand);
formHome.addCommand(page1);
formHome.addCommand(page2);
formHome.addCommand(page3);
formHome.setCommandListener(this);
Display.getDisplay(this).setCurrent(formHome);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(true);
notifyDestroyed();
} else if (c == page1) {
Form formPage1 = new Form("Page 1");
formPage1.append("This is page 1");
formPage1.addCommand(home);
formPage1.addCommand(page2);
formPage1.addCommand(page3);
formPage1.addCommand(exitCommand);
formPage1.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage1);
} else if (c == page2) {
Form formPage2 = new Form("Page 2");
formPage2.append("This is page 2");
formPage2.addCommand(home);
formPage2.addCommand(page1);
formPage2.addCommand(page3);
formPage2.addCommand(exitCommand);
formPage2.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage2);
} else if (c == page3) {
Form formPage3 = new Form("Page 3");
formPage3.append("This is page 3");
formPage3.addCommand(home);
formPage3.addCommand(page1);
formPage3.addCommand(page2);
formPage3.addCommand(exitCommand);
formPage3.setCommandListener(this);
Display.getDisplay(this).setCurrent(formPage3);
} else if (c == home) {
startApp();
}
}
}
Jumat, 06 Desember 2013
Traffic Light System
- The system is a roster of four times in each branch of the road, except to turn left directly
- If one branch of green lighted streets, the only branch right next to the one who should be allowed to turn left directly
- In the four-way branches, each branch 2 edge must be paired sensor road vehicle counters.
- Sensors are used to count the number of vehicles in the four branches of the vehicle in one cycle time, so the program can determine the portion of the red light and green light in each branch
- Software will determine the most number of vehicles based on data that have been obtained from the sensor , and determines the amount of time for each branch of the sensor , branch with most vehicles will get more green light times
- If there is no vehicle in one of the branches, then the system will turn on the red light on the branch, and will continue until there are vehicles that are in the branch
Senin, 11 November 2013
Software Processes
In software-making,there are 6 different type of software process:
1.Waterfall
2.Prototyping
3.Iterative Developement
4.Rational Unified Process
5.Timeboxing
6.Extreme Programming and Agile Process
Each type of process have its own benefit and shortage
1.Waterfall
2.Prototyping
3.Iterative Developement
4.Rational Unified Process
5.Timeboxing
6.Extreme Programming and Agile Process
Each type of process have its own benefit and shortage
1
|
2
|
3
|
4
|
5
|
6
|
|
Risk on software-making
|
H
|
L
|
L
|
L
|
L
|
M
|
Quality of the product
|
H
|
L
|
H
|
H
|
H
|
M
|
Time Efficiency
|
L
|
H
|
H
|
H
|
H
|
H
|
Maintainability in the process
|
N
|
Y
|
Y
|
Y
|
Y
|
Y
|
Management
|
Linear
|
Linear
|
Paralel
|
Paralel
|
Paralel
|
|
Difficulty on software-making
|
H
|
M
|
H
|
?
|
M
|
H = High
M = Medium
L = Low
N = No
Y = Yes
Kamis, 07 April 2011
The Beginning -
Hello!welcome to my blog!well,i never write or post in a blog before hahaha,but my teacher in school ask us(me and my friend) to create a blog and share our blog to others... haha enjoy my blog!
Langganan:
Komentar (Atom)