كود برنامج خدمات مطار

استعرض الموضوع السابق استعرض الموضوع التالي اذهب الى الأسفل

كود برنامج خدمات مطار

مُساهمة من طرف أيمن الإبراهيم في الأربعاء أغسطس 21, 2013 1:56 pm

تستطيع عن طريق برنامج حجز مسبق في اي مطار للسفر
برنامج رائع 

1- قم بفتح netbeans
2- اختر مشروع جديد
3- اختر javame ثم mobile application
4- قم باختيار اسم البرنامج VoiceRecordMidlet ثم  قم بالغاء خيار create hello midlet ثم تالي
5- قم باخيار المحاكي ثم تالي
6- اغلاق

الان قم باختيارSource packagesوقم بتسمية الحزمة FlightBooker ثم اضغط قم باضافة MIDlet ثم اكتب اسم mFlight
تظهر صفحة كتابة الكود وموجود بها  الكود التالي:



package FlightBooker;

import FlightBooker.images;
import java.io.IOException;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.midlet.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.*;
import java.util.Calendar;

/**
* @author Hustla
*/
public class mFlight extends MIDlet implements CommandListener {

Ticker ticker = new Ticker("اهلا وسهلا بكم في مطار منتدى مصر التقني!");
Alert alert;
Form myNames, myContacts, CheckDetails, flightDetails,fee;
List main, region, destin, airways, deck, type;
TextField input1Name = new TextField("ادخل اسمك الاول ", "", 20, TextField.ANY);
TextField Booking_Ref = new TextField("ادخل رقم الحجز ", "", 4, TextField.PASSWORD);
TextField input3Name = new TextField("ادخل الكنية ", "", 20, TextField.ANY);
TextField age = new TextField("ادخل عمرك", "", 20, TextField.DECIMAL);
TextField input2Name = new TextField("ادخل اسم الاب", "", 20, TextField.ANY);
TextField emailAddr = new TextField("ادخل ايميل ", "", 40, TextField.EMAILADDR);
TextField POBOX = new TextField("ادخل عنوان بريد الالكتروني\nP.O BOX:", "", 10, TextField.ANY);
TextField luggage = new TextField("Input your estimated Luggage Weight(in Kgs)", "", 10, TextField.ANY);
TextField misc = new TextField("Input any other details \n e.g allergies,special diet,stop-overs ", "", 40, TextField.ANY);
TextField deptDate = new TextField("Input your desired Date Of departure\nIn the order DD/MM/YY\n", " ", 10, TextField.ANY);
TextField retunDate = new TextField("Input your desired Date Of Return \nOnly if it's a Return trip\nIn the order DD/MM/YY\n", "", 10, TextField.ANY);
TextField destination = new TextField("ادخل الجهة المطلوب اي منطقة\n", "", 30, TextField.ANY);
TextField departure = new TextField("ادخل اسم المطار مغادرة \n", "", 30, TextField.ANY);
TextField phoneNumb = new TextField("ادخل رقم موبايل \n+963", "", 20, TextField.PHONENUMBER);
TextField accNumb = new TextField("Input your 16 digit VISA-enabled bank account number","", 16, TextField.PASSWORD);
TextField accPsword = new TextField("Input your four digit bank account pin ", "", 4, TextField.PASSWORD);
Display screen = Display.getDisplay(this);
Command exit = new Command("Exit", Command.EXIT, 2);
Command back = new Command("Back", Command.BACK, 2);
Command OK = new Command("OK", Command.OK, 2);
Calendar c = Calendar.getInstance();
//private Object hustla_1;

public mFlight() {
}

public void startApp() {


String mainchoice[] = {"حجز", "تدقيق التفصيلي"};
main = new List("The Mobile Flight Booking Service ", List.IMPLICIT, mainchoice, null);
main.setTicker(ticker);
main.addCommand(OK);
main.addCommand(exit);
main.setCommandListener(this);
myNames = new Form("My Names:");
myNames.append(input1Name);
myNames.append(input2Name);
myNames.append(input3Name);
myNames.append(age);
myNames.setTicker(ticker);
myNames.addCommand(exit);
myNames.addCommand(OK);
myNames.setTicker(ticker);
myNames.setCommandListener(this);
myContacts = new Form("My Contacts");
myContacts.append(phoneNumb);
myContacts.append(POBOX);
myContacts.append(emailAddr);

myContacts.setTicker(ticker);
myContacts.addCommand(OK);
myContacts.addCommand(exit);
myContacts.setCommandListener(this);
String regions[] = {"Local", "International"};
region = new List("Choose your Destinations Region:", List.IMPLICIT, regions, null);
region.addCommand(OK);
region.addCommand(exit);
region.setCommandListener(this);
String flt_providers[] = {"KQ", "Emirates", "British Airways", "Uganda Airways"};
airways = new List("اختر الخطوط الجوية", List.EXCLUSIVE, flt_providers, null);
airways.addCommand(OK);
airways.addCommand(exit);
airways.setCommandListener(this);
flightDetails = new Form("Flight Details");
String ticket[] = {"رحلة واحده", "`ذهاب اياب"};
type = new List("دقق نوع الطيران:", List.EXCLUSIVE, ticket, null);
type.addCommand(OK);
type.addCommand(exit);
type.setCommandListener(this);
String level[] = {"الدرجة الاولى", "عمل", "السائح", "Coach"};
deck = new List("دقق صنف الرحلة:", List.EXCLUSIVE, level, null);
deck.addCommand(OK);
deck.addCommand(exit);
deck.setCommandListener(this);
flightDetails = new Form("Flight Details");
flightDetails.append(destination);
flightDetails.append(departure);
flightDetails.append(deptDate);
flightDetails.append(retunDate);
flightDetails.addCommand(OK);
flightDetails.addCommand(exit);
flightDetails.setCommandListener(this);
CheckDetails = new Form("Check My Flight Details");
CheckDetails.append(Booking_Ref);
CheckDetails.addCommand(OK);
CheckDetails.addCommand(exit);
CheckDetails.setCommandListener(this);
fee = new Form ("تفاصيل المصرف");
fee.append("حساب مصرفي!");
fee.append(accNumb);
fee.append(accPsword);

fee.addCommand(OK);
fee.addCommand(exit);
fee.setCommandListener(this);
login();
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
notifyDestroyed();
}

public void login() {

alert = new Alert("mFlight", " \tWelcome To The Mobile Flight Booking Service\n\n\n\n A Hustla Production ", null, AlertType.ALARM);
// boolean flashBacklight = screen.flashBacklight(100);
screen.setCurrent(alert, main);
// screen.setCurrent( alert);
}

public void commandAction(Command cmd, Displayable current) {

String name;
if (cmd == exit) {
this.destroyApp(true);
this.notifyDestroyed();
} else if (cmd == OK) {
if (current == main) {
int choice = main.getSelectedIndex();
if ( choice == 0){
ticker.setString("قائمة الدخول ");
screen.setCurrent(myNames);
}
else if ( choice == 1){
alert = new Alert("Type in Personal Booking Refference") ;
alert.setTimeout(1000);
screen.setCurrent(alert, CheckDetails);
}

} else if( current == CheckDetails){
String bknref= Booking_Ref.getString();
alert = new Alert("Thank You For Using This Service!");
alert.setString("You will soon receive an SMS with your flight details!");
alert.setTimeout(Alert.FOREVER);
Booking_Ref.setString("");
screen.setCurrent(alert,main);

} else if (current == myNames) {

ticker.setString("قائمة الاخيارات");
// alert = new Alert("Confirm Names","You names are: \n\n"+ name1 +" "+name2+" "+name3+"?", null,AlertType.CONFIRMATION);
screen.setCurrent(myContacts);

} else if (current == myContacts) {


// alert = new Alert("Confirm Contacts","You email address is: \n"+ emailadd +"\n\nPhone Number is:\n "+ phonenmb+"\n and P.O BOX is:\n"+pobox+"?", null,AlertType.CONFIRMATION);
screen.setCurrent(flightDetails);
} else if (current == flightDetails) {


// alert = new Alert("Confirm Destination","Your destination is:"+destiny+"?", null, AlertType.CONFIRMATION);
screen.setCurrent(airways);
} else if (current == airways) {

// alert = new Alert ("Confirm Preffered Airways","You Chose to fly with :"+ prefdairwy+"?",null,AlertType.CONFIRMATION);
screen.setCurrent(type);
} else if (current == type) {

// alert = new Alert ("Confirm type of ticket","You Choose to fly:"+ tckt+"?",null,AlertType.CONFIRMATION);
screen.setCurrent(deck);
} else if (current == deck) {
String deckclass = deck.getString(deck.getSelectedIndex());
// alert = new Alert ("Confirm class","You Choose to fly:"+ deckclass+"?",null,AlertType.CONFIRMATION);
String tckt = type.getString(type.getSelectedIndex());
String deptfrom = departure.getString();
String depton = deptDate.getString();
String prefdairwy = airways.getString(airways.getSelectedIndex());
String retdate = retunDate.getString();
String dateofdept = deptDate.getString();
String destiny = destination.getString();
String lugg = luggage.getString();
String Misc = misc.getString();
String emailadd = emailAddr.getString();
String pobox = POBOX.getString();
String phonenmb = phoneNumb.getString();
String name1 = input1Name.getString();
String name3 = input3Name.getString();
String name2 = input2Name.getString();
String myage = age.getString();

alert = new Alert("Confirm Flight Details");
String time = c.getTime().toString();
alert.setString("Date:"+time+"\nNames:\n" + name1 + " " + name2 + " " + name3 +"\nAge\n"+myage+ "\nEmail Address:\n" + emailadd +
"\nPhone Number: \n+254" + phonenmb + "\nPostal Address:\n" + pobox + "\nDestination:\n" + destiny + "\nDeparting from:\n"+deptfrom+"\nDeparting "+
"on:\n"+depton+"\nReturnig on:\n"+retdate+"\nPreffered" +
" Airways\n" + prefdairwy + "\nTrip ticket:\n" + tckt + "\nClass:\n" + deckclass + "?");
alert.setType(AlertType.CONFIRMATION);
alert.setTimeout(Alert.FOREVER);
screen.flashBacklight(1000);
screen.setCurrent( alert,fee);

}
else if (current == fee){
String acntnumb = accNumb.getString();
String acpaswd =accPsword.getString();
alert = new Alert("Wait for mFlight to respond!\nKeep the Booking Refferecne you will receive\nsafely as it is the only means to" +
" ID \nyourself at the airport!\n\nThank YOU For Using The Mobile Flight Booking Service.");
alert.setTimeout(Alert.FOREVER);
screen.flashBacklight(1000);
screen.setCurrent(alert, main);
departure.setString("");
retunDate.setString("");
deptDate.setString("");
input1Name.setString("");
input2Name.setString("");
input3Name.setString("");
age.setString("");
emailAddr.setString("");
POBOX.setString("");
phoneNumb.setString("");
destination.setString("");
luggage.setString("");
// misc.setString("");

}
}



}
}

أيمن الإبراهيم
........
........

تاريخ التسجيل : 19/03/2013
المساهمات : 251
النقاط : 397
التقيم : 0
الدولة : سوريا
الجنس : ذكر

الرجوع الى أعلى الصفحة اذهب الى الأسفل

استعرض الموضوع السابق استعرض الموضوع التالي الرجوع الى أعلى الصفحة


 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى