Login page
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
public class InternationalFlight extends JFrame
{
JComboBox CBFrom, CBTo, CBClass, CBAdult, CBChildren, CBInfant;
JLabel LFrom, LTo, LBookingDate, LClass, LAdult, LChildren, LInfant, LBookingDetails,
LPassengerDetails, LDate, LImg1, LImg2, LNotes;
JTextField TFBookingDate;
Icon img1, img2;
JButton BFindFlight;
JPanel PPanel1, PPanel2;
LoginPage type1;
public InternationalFlight(LoginPage type1)
{
Container c =getContentPane();
[Link](new BorderLayout());
String[] sItem1={"Trivandrum"};
String[]
sItem2={"Bali","Bangkok","Cairo","CapeTown","Chicago","Dubai","Frankfurt","HongKong","Istan
bul","London","LosAngeles","Melbourne","New
York","Paris","Rome","SanFrancisco","shanghai","Singapore","Sydney","Toronto"};
String[] sItem3={"Economic","Business"};
this.type1 = type1;
PPanel1 = new JPanel(null);
[Link](new Dimension(500,200));
LBookingDetails = new JLabel("<html><b><font color=\"#C71585\">Booking
Details</font></b></html>");
LFrom = new JLabel("From :");
LTo = new JLabel("To :");
LBookingDate = new JLabel("Booking Date:");
LClass = new JLabel("Class :");
CBFrom = new JComboBox(sItem1);
CBTo = new JComboBox(sItem2);
CBClass = new JComboBox(sItem3);
TFBookingDate = new JTextField(10);
LDate = new JLabel("(DD/MM/YYYY)");
[Link]([Link]);
img1=new ImageIcon("[Link]");
LImg1 = new JLabel(img1);
BFindFlight = new JButton("Find Flight");
[Link](20,3,100,20);
[Link](20,40,100,20);
[Link](100,40,100,20);
[Link](20,100,100,20);
[Link](100,100,100,20);
[Link](14,160,100,20);
[Link](100,160,100,20);
[Link](210,160,100,20);
[Link](20,220,100,20);
[Link](100,220,100,20);
[Link](50,270,100,25);
[Link](0,290,495,260);
[Link](LBookingDetails);
[Link](LFrom);
[Link](CBFrom);
[Link](LTo);
[Link](CBTo);
[Link](LBookingDate);
[Link](TFBookingDate);
[Link](LDate);
[Link](LClass);
[Link](CBClass);
[Link](BFindFlight);
[Link](LImg1);
[Link]([Link]);
[Link](PPanel1,[Link]);
PPanel2 = new JPanel(null);
[Link](new Dimension(320,160));
LPassengerDetails=new JLabel("<html><b><font
color=\"#C71585\">PassengerDetails</font></b></html>");
LAdult = new JLabel("Adults(12+)");
LChildren = new JLabel("Children(2-11)");
LInfant = new JLabel("Infants(under 2)");
String[] item4={"1","2","3","4","5","6"};
CBAdult = new JComboBox(item4);
String[] item5={"0","1","2","3","4"};
CBChildren = new JComboBox(item5);
String[] item6={"0","1","2","3"};
CBInfant = new JComboBox(item6);
img2 = new ImageIcon("note_bg.gif");
LImg2 = new JLabel(img2);
LNotes = new JLabel("<html><body><p>NOTE: Bookings with International
Credit Cards <p> have temporarily been [Link] Service<p> will resume shortly and we
will have a notice<p> posted on our [Link] regret any <p>inconvenience caused to our
passengers.</body></html>");
[Link](40,3,100,20);
[Link](40,40,100,20);
[Link](140,40,100,20);
[Link](40,105,100,20);
[Link](140,105,100,20);
[Link](40,170,100,20);
[Link](140,170,100,20);
[Link](16,220,320,200);
[Link](55,240,380,180);
[Link](LPassengerDetails);
[Link](LAdult);
[Link](LChildren);
[Link](LInfant);
[Link](CBAdult);
[Link](CBChildren);
[Link](CBInfant);
[Link](LNotes);
[Link](LImg2);
[Link]([Link]);
[Link](PPanel2,[Link]);
setSize(795,580);
setVisible(true);
[Link](new button2(this, type1));
}
public static void main(String args[])
{
LoginPage type1=null;
new InternationalFlight(type1);
}
}
class button2 implements ActionListener
{
InternationalFlight type;
LoginPage type1;
button2(InternationalFlight type, LoginPage type1)
{
[Link] = type;
this.type1 = type1;
}
public void actionPerformed(ActionEvent e)
{
String sFrom = (String)[Link]();
String sTo = (String)[Link]();
String sClass = (String)[Link]();
String sBookingDate = [Link]();
Integer iPrice=0;
String sTime="";
Integer iAdult = [Link]((String)[Link]());
Integer iChildren = [Link]((String)[Link]());
Integer iInfant = [Link]((String)[Link]());
int i = 0;
if([Link]("Economic"))
{
try{
while(i<20)
{
if(type1.row2[i][1].equals(sTo))
{
iPrice = [Link]((String)type1.row2[i][2]);
sTime = (String)type1.row2[i][3];
break;
}
i++;
}
}catch(Exception e1)
{
[Link](null, "You have no rights to
access");
[Link](0);
}
}
else
{
try
{
while(i<20)
{
if(type1.row2[i][1].equals(sTo))
{
iPrice = [Link]((String)type1.row4[i][2]);
sTime = (String)type1.row4[i][3];
break;
}
i++;
}
}catch(Exception e1)
{
[Link](null, "You have no rights to
access it");
[Link](0);
}
}
[Link](iPrice + " " + sTime);
iPrice = (iPrice*iAdult)+(iPrice*(iChildren/2));
int iCount=0;
int iSeatCount=0;
String[] sTempFrom=new String[1250];
String[] sTempTo=new String[1250];
String[] sTempClass=new String[1250];
String[] sTempBookingDate=new String[1250];
String[] sTempTime=new String[1250];
Integer[] iTempAdult=new Integer[1250];
Integer[] iTempChildren=new Integer[1250];
Integer[] iTempInfant=new Integer[1250];
Integer[] iTempPrice=new Integer[1250];
try
{
//read from data
Save1 save1;
ObjectInputStream OIS1 = new ObjectInputStream(new
FileInputStream("save1"));
do
{
save1 = (Save1)[Link]();
sTempFrom[iCount] = [Link];
sTempTo[iCount] = [Link];
sTempClass[iCount] = [Link];
sTempBookingDate[iCount] = [Link];
sTempTime[iCount] = [Link];
iTempAdult[iCount] = [Link];
iTempChildren[iCount] = [Link];
iTempInfant[iCount] = [Link];
iTempPrice[iCount] = [Link];
iCount++;
if([Link](sBookingDate))
if([Link](sTo))
iSeatCount=iSeatCount + [Link] +
[Link] + [Link];
}while(save1!=null);
[Link]();
}
catch(Exception e1)
{
}
iSeatCount = iSeatCount + iAdult + iChildren + iInfant;
if(iSeatCount > 60)
{
[Link](null,"Seats are full. Sorry!");
}
else
{
int iChoice = [Link](null,"Seats available. Do
you want to Book now?");
if(iChoice == JOptionPane.YES_OPTION)
{
new PrintTicket1(sFrom, sTo, sClass, iAdult, iChildren, iInfant,
sBookingDate, iPrice, sTime);
try
{
//write into data
Save1 save2=new Save1(sFrom, sTo, sClass, iAdult, iChildren,
iInfant, sBookingDate, iPrice, sTime);
ObjectOutputStream OOS1 = new ObjectOutputStream(new
FileOutputStream("save1"));
for(i=0;i<iCount;i++)
{
Save1 temp1=new Save1(sTempFrom[i], sTempTo[i],
sTempClass[i], iTempAdult[i], iTempChildren[i], iTempInfant[i], sTempBookingDate[i],
iTempPrice[i], sTempTime[i]);
[Link](temp1);
[Link](temp1);
}
[Link](save2);
[Link]();
}catch(Exception e1)
{
[Link](e1);
}
}
else
{
}
}
}
}
class Save1 implements Serializable
{
String sFrom, sTo, sClass, sBookingDate, sTime;
Integer iPrice, iAdult, iChildren, iInfant;
// int iCount;
public Save1(String sFrom, String sTo, String sClass, Integer iAdult, Integer iChildren,
Integer iInfant, String sBookingDate, Integer iPrice, String sTime)
{
[Link]=sFrom;
[Link]=sTo;
[Link]=sClass;
[Link]=iAdult;
[Link]=iChildren;
[Link]=iInfant;
[Link]=sBookingDate;
[Link]=iPrice;
[Link]=sTime;
// [Link] = iCount;
}
public String toString()
{
return sFrom+" "+sTo+" "+sClass+" "+iAdult+" "+iChildren+" "+iInfant+"
"+sBookingDate+" "+iPrice+" "+sTime;
}
}