├── .gitattributes ├── DomesticFlight.class ├── DomesticFlight.java ├── ExitListener.class ├── ExitListener.java ├── InternationalFlight.class ├── InternationalFlight.java ├── LoginPage.class ├── LoginPage.java ├── PrintTicket1.class ├── PrintTicket1.java ├── README.md ├── Save1.class ├── Save2.class ├── WindowUtilities.class ├── WindowUtilities.java ├── airline project.pdf ├── button1.class ├── button2.class ├── button3.class ├── img ├── Thumbs.db ├── business.jpg ├── business1.JPG ├── economic.jpg └── economic1.JPG ├── map1.jpg ├── mouse1.class ├── mouse2.class ├── mouse3.class ├── note_bg.gif ├── readme.txt └── save2 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /DomesticFlight.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projectworldsofficial/Airline-reservation-system-java/afe805b5d685a319eefe2e79d9a7327f5e624a0c/DomesticFlight.class -------------------------------------------------------------------------------- /DomesticFlight.java: -------------------------------------------------------------------------------- 1 | import javax.swing.*; 2 | import java.awt.*; 3 | import java.awt.event.*; 4 | import java.io.*; 5 | 6 | public class DomesticFlight extends JFrame 7 | { 8 | JComboBox CBFrom, CBTo, CBClass, CBAdult, CBChildren, CBInfant; 9 | JLabel LFrom, LTo, LBookingDate, LClass, LAdult, LChildren, LInfant, LBookingDetails, LPassengerDetails, LDate, LImg1, LImg2, LNotes; 10 | JTextField TFBookingDate; 11 | Icon img1, img2; 12 | JButton BFindFlight; 13 | JPanel PPanel1, PPanel2; 14 | 15 | LoginPage type1; 16 | 17 | public DomesticFlight(LoginPage type1) 18 | { 19 | Container c =getContentPane(); 20 | c.setLayout(new BorderLayout()); 21 | String[] sItem1={"Trivandrum"}; 22 | String[] sItem2 ={ "Bangalore", "Chennai ", "Delhi", "Goa", "Hyderabad", "Kolkata", "Lucknow", "Mumbai", "Vishakapatnam" }; 23 | String[] sItem3={"Economic","Business"}; 24 | 25 | this.type1 = type1; 26 | PPanel1 = new JPanel(null); 27 | PPanel1.setPreferredSize(new Dimension(500,200)); 28 | 29 | LBookingDetails = new JLabel("Booking Details"); 30 | LFrom = new JLabel("From :"); 31 | LTo = new JLabel("To :"); 32 | LBookingDate = new JLabel("Booking Date:"); 33 | LClass = new JLabel("Class :"); 34 | 35 | CBFrom = new JComboBox(sItem1); 36 | CBTo = new JComboBox(sItem2); 37 | CBClass = new JComboBox(sItem3); 38 | 39 | TFBookingDate = new JTextField(10); 40 | LDate = new JLabel("(DD/MM/YYYY)"); 41 | LDate.setForeground(Color.red); 42 | 43 | img1=new ImageIcon("map1.jpg"); 44 | LImg1 = new JLabel(img1); 45 | 46 | BFindFlight = new JButton("Find Flight"); 47 | 48 | LBookingDetails.setBounds(20,3,100,20); 49 | 50 | LFrom.setBounds(20,40,100,20); 51 | CBFrom.setBounds(100,40,100,20); 52 | 53 | LTo.setBounds(20,100,100,20); 54 | CBTo.setBounds(100,100,100,20); 55 | 56 | LBookingDate.setBounds(14,160,100,20); 57 | TFBookingDate.setBounds(100,160,100,20); 58 | LDate.setBounds(210,160,100,20); 59 | 60 | LClass.setBounds(20,220,100,20); 61 | CBClass.setBounds(100,220,100,20); 62 | 63 | BFindFlight.setBounds(50,270,100,25); 64 | 65 | LImg1.setBounds(0,290,495,260); 66 | 67 | PPanel1.add(LBookingDetails); 68 | PPanel1.add(LFrom); 69 | PPanel1.add(CBFrom); 70 | PPanel1.add(LTo); 71 | PPanel1.add(CBTo); 72 | PPanel1.add(LBookingDate); 73 | PPanel1.add(TFBookingDate); 74 | PPanel1.add(LDate); 75 | PPanel1.add(LClass); 76 | PPanel1.add(CBClass); 77 | PPanel1.add(BFindFlight); 78 | PPanel1.add(LImg1); 79 | PPanel1.setBackground(Color.white); 80 | 81 | c.add(PPanel1,BorderLayout.WEST); 82 | 83 | PPanel2 = new JPanel(null); 84 | PPanel2.setPreferredSize(new Dimension(320,160)); 85 | 86 | LPassengerDetails=new JLabel("PassengerDetails"); 87 | 88 | LAdult = new JLabel("Adults(12+)"); 89 | 90 | LChildren = new JLabel("Children(2-11)"); 91 | LInfant = new JLabel("Infants(under 2)"); 92 | 93 | String[] item4={"1","2","3","4","5","6"}; 94 | CBAdult = new JComboBox(item4); 95 | 96 | String[] item5={"0","1","2","3","4"}; 97 | CBChildren = new JComboBox(item5); 98 | 99 | String[] item6={"0","1","2","3"}; 100 | CBInfant = new JComboBox(item6); 101 | 102 | img2 = new ImageIcon("note_bg.gif"); 103 | LImg2 = new JLabel(img2); 104 | LNotes = new JLabel("
NOTE: Bookings with International Credit Cards
have temporarily been suspended.This Service
will resume shortly and we will have a notice
posted on our website.We regret any
inconvenience caused to our passengers.");
105 |
106 | LPassengerDetails.setBounds(40,3,100,20);
107 |
108 | LAdult.setBounds(40,40,100,20);
109 | CBAdult.setBounds(140,40,100,20);
110 |
111 | LChildren.setBounds(40,105,100,20);
112 | CBChildren.setBounds(140,105,100,20);
113 |
114 | LInfant.setBounds(40,170,100,20);
115 | CBInfant.setBounds(140,170,100,20);
116 |
117 | LImg2.setBounds(16,220,320,200);
118 | LNotes.setBounds(55,240,380,180);
119 |
120 | PPanel2.add(LPassengerDetails);
121 | PPanel2.add(LAdult);
122 | PPanel2.add(LChildren);
123 | PPanel2.add(LInfant);
124 | PPanel2.add(CBAdult);
125 | PPanel2.add(CBChildren);
126 | PPanel2.add(CBInfant);
127 |
128 | PPanel2.add(LNotes);
129 | PPanel2.add(LImg2);
130 |
131 | PPanel2.setBackground(Color.white);
132 |
133 | c.add(PPanel2,BorderLayout.EAST);
134 |
135 | setSize(795,580);
136 | setVisible(true);
137 |
138 | BFindFlight.addActionListener(new button3(this, type1));
139 | }
140 | public static void main(String args[])
141 | {
142 | LoginPage type1=null;
143 | new DomesticFlight(type1);
144 | }
145 | }
146 |
147 | class button3 implements ActionListener
148 | {
149 | DomesticFlight type;
150 | LoginPage type1;
151 | button3(DomesticFlight type, LoginPage type1)
152 | {
153 | this.type = type;
154 | this.type1 = type1;
155 | }
156 | public void actionPerformed(ActionEvent e)
157 | {
158 | String sFrom = (String)type.CBFrom.getSelectedItem();
159 | String sTo = (String)type.CBTo.getSelectedItem();
160 | String sClass = (String)type.CBClass.getSelectedItem();
161 | String sBookingDate = type.TFBookingDate.getText();
162 | Integer iPrice=0;
163 | String sTime="";
164 |
165 |
166 | Integer iAdult = Integer.parseInt((String)type.CBAdult.getSelectedItem());
167 | Integer iChildren = Integer.parseInt((String)type.CBChildren.getSelectedItem());
168 | Integer iInfant = Integer.parseInt((String)type.CBInfant.getSelectedItem());
169 |
170 | int i = 0;
171 |
172 | if(sClass.equals("Economic"))
173 | {
174 | try{
175 | while(i<20)
176 | {
177 | if(type1.row1[i][1].equals(sTo))
178 | {
179 | iPrice = Integer.parseInt((String)type1.row1[i][2]);
180 | sTime = (String)type1.row1[i][3];
181 | break;
182 | }
183 | i++;
184 | }
185 | }catch(Exception e1)
186 | {
187 | JOptionPane.showMessageDialog(null, "You have no rights to access");
188 | System.exit(0);
189 | }
190 | }
191 | else
192 | {
193 | try
194 | {
195 | while(i<20)
196 | {
197 | if(type1.row1[i][1].equals(sTo))
198 | {
199 | iPrice = Integer.parseInt((String)type1.row3[i][2]);
200 | sTime = (String)type1.row3[i][3];
201 | break;
202 | }
203 | i++;
204 | }
205 | }catch(Exception e1)
206 | {
207 | JOptionPane.showMessageDialog(null, "You have no rights to access it");
208 | System.exit(0);
209 | }
210 | }
211 | type.setTitle(iPrice + " " + sTime);
212 |
213 | iPrice = (iPrice*iAdult)+(iPrice*(iChildren/2));
214 |
215 | int iCount=0;
216 | int iSeatCount=0;
217 |
218 | String[] sTempFrom=new String[1250];
219 | String[] sTempTo=new String[1250];
220 | String[] sTempClass=new String[1250];
221 | String[] sTempBookingDate=new String[1250];
222 | String[] sTempTime=new String[1250];
223 | Integer[] iTempAdult=new Integer[1250];
224 | Integer[] iTempChildren=new Integer[1250];
225 | Integer[] iTempInfant=new Integer[1250];
226 | Integer[] iTempPrice=new Integer[1250];
227 |
228 | try
229 | {
230 | //read from data
231 | Save2 save1;
232 | ObjectInputStream OIS1 = new ObjectInputStream(new FileInputStream("save2"));
233 | do
234 | {
235 | save1 = (Save2)OIS1.readObject();
236 | sTempFrom[iCount] = save1.sFrom;
237 | sTempTo[iCount] = save1.sTo;
238 | sTempClass[iCount] = save1.sClass;
239 | sTempBookingDate[iCount] = save1.sBookingDate;
240 | sTempTime[iCount] = save1.sTime;
241 | iTempAdult[iCount] = save1.iAdult;
242 | iTempChildren[iCount] = save1.iChildren;
243 | iTempInfant[iCount] = save1.iInfant;
244 | iTempPrice[iCount] = save1.iPrice;
245 |
246 | iCount++;
247 | if(save1.sBookingDate.equals(sBookingDate))
248 | if(save1.sTo.equals(sTo))
249 | iSeatCount=iSeatCount + save1.iAdult + save1.iChildren + save1.iInfant;
250 | }while(save1!=null);
251 | OIS1.close();
252 |
253 | }
254 | catch(Exception e1)
255 | {
256 | }
257 |
258 | iSeatCount = iSeatCount + iAdult + iChildren + iInfant;
259 |
260 | if(iSeatCount > 60)
261 | {
262 | JOptionPane.showMessageDialog(null,"Seats are full. Sorry!");
263 | }
264 | else
265 | {
266 | int iChoice = JOptionPane.showConfirmDialog(null,"Seats available. Do you want to Book now?");
267 | if(iChoice == JOptionPane.YES_OPTION)
268 | {
269 | new PrintTicket1(sFrom, sTo, sClass, iAdult, iChildren, iInfant, sBookingDate, iPrice, sTime);
270 | try
271 | {
272 | //write into data
273 | Save2 save2=new Save2(sFrom, sTo, sClass, iAdult, iChildren, iInfant, sBookingDate, iPrice, sTime);
274 | ObjectOutputStream OOS1 = new ObjectOutputStream(new FileOutputStream("save2"));
275 | for(i=0;i