Java Program For Airport Management System
import java.util.Scanner;
import java.lang.String;
import java.util.ArrayList;
class arrival{
String name;
int id;
String address;
String time;
double fare;
public static int count = 1;
public arrival(String nm,int id,String address,String time,double fare)
{
this.name=nm;
this.id=id;
this.address=address;
this.time=time;
this.fare=fare;
System.out.println("FLIGHT ARRIVAL DETAILS ARE--------");
System.out.println("-----------------------------------");
System.out.println("name of flight is----"+nm);
System.out.println("id of flight is------"+id);
System.out.println("address of flight is------"+address);
System.out.println("time of arrival is-------"+time);
System.out.println("fare of this flight is------"+fare);
System.out.println("arrival count is--------->"+count++);
System.out.println("-----------------------------------");
}
}
class departure{
String name;
int id;
String address;
String time;
double fare;
public static int count = 1;
public departure(String nm,int id,String address,String time,double fare)
{
this.name=nm;
this.id=id;
this.address=address;
this.time=time;
this.fare=fare;
System.out.println("FLIGHT DEPARTED DETAILS ARE--------");
System.out.println("-----------------------------------");
System.out.println("name of flight is----"+nm);
System.out.println("id of flight is------"+id);
System.out.println("address of flight is------"+address);
System.out.println("time of departure is-------"+time);
System.out.println("fare of this flight is------"+fare);
System.out.println("departure count is--------->"+count--);
System.out.println("-----------------------------------");
}
}
class enquiry{
String name;
int id;
String address;
String time;
double fare;
public static String count = "AVAILABLE";
public enquiry(String nm,int id,String address,String time,double fare)
{
Scanner sc = new Scanner(System.in);
this.name=nm;
this.id=id;
this.address=address;
this.time=time;
this.fare=fare;
String locate;
System.out.println("ENTER CURRENT AIRPORT STATION TO FLY<---------->");
locate = sc.nextLine();
if(locate.equals("AMRITSAR"))
{
System.out.println("-------SEATS AVAILABLE------");
System.out.println("-----------------------------------");
System.out.println("name of flight is----"+nm);
System.out.println("id of flight is------"+id);
System.out.println("address of flight is------"+address);
System.out.println("time of departure is-------"+time);
System.out.println("fare of this flight is------"+fare);
System.out.println("STATUS OF CONFIRMATION IS--------->"+count);
System.out.println("-----------------------------------");
}
else
{
System.out.println("-------->SORRY SEATS ARE NOT AVAILABLE----->");
}
}
}
class Passenger {
String name, address, timing, fladdress;
int age, flid;
double fare;
public Passenger(String name, int age, String address, String timing,
String fladdress, int flid, double fare) {
this.name = name;
this.address = address;
this.timing = timing;
this.fladdress = fladdress;
this.age = age;
this.flid = flid;
this.fare = fare;
}
public boolean SearchPassenger(String nm) {
if (name.equals(nm)) {
System.out.println("PASSENGER SUCCESSFULLY ENTERED IN DATABASE------");
System.out.println("----------->>PASSENGER'S DETAILS ARE------------>>");
System.out.println("FULL NAME IS-------" + name);
System.out.println("PASSENGER'S AGE----------" + age);
System.out.println("PASSENGER'S ADDRESS-----" + address);
System.out.println("FLIGHT TIMING IS---------" + timing);
System.out.println("JOURNEY FROM AND TO---------" + fladdress);
System.out.println("FLIGHT ID IS-----------" + flid);
System.out.println("TOTAL FARE OF JOURNEY IS-------" + fare);
System.out.println("-----HAPPY JOURNEY---------");
return true;
}
else {
return false;
}
}
}
class airf {
public static void main(String[] args) {
int t=1;
do {
Scanner sc = new Scanner(System.in);
System.out.println("--------------------------------------------------
---");
System.out.println("-----WELCOME TO AMIT'S AIRPORT MANAGEMENT SYSTEM--
----");
System.out.println("-------------------------------------------------------");
System.out.println("CHOOSE YOUR SPECIFIC OPERATION---------");
System.out.println("1.) ARRIVAL'S--------");
System.out.println("2.) DEPARTURE'S-------");
System.out.println("3.) ENQUIRY'S---------");
System.out.println("4.) SHOW ADDED PASSENGER'S BY SEARCH METHOD'S <---------->");
int no = sc.nextInt();
switch (no) {
case 1:
arrival fl = new arrival("AIRINDIA", 456321, "LKO TO ASR",
"11:54-PM", 4512.63);
arrival f2 = new arrival("JETAIRWAYS", 458421, "SIWAN TO ASR",
"12:45-AM", 84521.32);
break;
case 2:
System.out.println("FIRST FLIGHT DEPARTED DELAY WITH 1
HOURS");
departure d1 = new departure("INDIGO", 145266, "PATNA TO
GORAKHPUR", "13:26-PM", 7865.3254);
departure d2 = new departure("GOAIR", 564789, "SIWAN TO
BANGALORE", "16:55-PM", 2865.8754);
break;
case 3:
enquiry e1 = new enquiry("EMIRATES", 456327, "AMRITSAR TO
SIWAN", "12:45-AM", 4562.84);
break;
case 4:
System.out.println("THIS IS PASSENGER'S RECORD'S AREA------>>");
Passenger p1 = new Passenger("AMIT", 19, "SIWAN", "10:05-PM",
"LKO TO ASR", 12345, 5632.21);
Passenger p2 = new Passenger("ALOK", 25, "PATNA", "12:05-AM",
"MUMBAI TO KANPUR", 54698, 9856.21);
ArrayList<Passenger> list = new ArrayList<>();
list.add(p1);
list.add(p2);
String searchname = "AMIT";
boolean found = false;
for (int i = 0; i <= 1; i++) {
Passenger pm = list.get(i);
found = pm.SearchPassenger(searchname);
if (found == true) {
break;
} else if (found == false) {
System.out.println(" ");
}
}
break;
default:
System.out.println("INVALID INPUT!!!!!!!");
}
System.out.println("DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER
KEY FOR NO----- ");
t = sc.nextInt();
} while (t==1);
}
}
Java Output ...................
-----------------------------------------------------
-----WELCOME TO AMIT'S AIRPORT MANAGEMENT SYSTEM-- ----
-------------------------------------------------------
CHOOSE YOUR SPECIFIC OPERATION---------
1.) ARRIVAL'S--------
2.) DEPARTURE'S-------
3.) ENQUIRY'S---------
4.) SHOW ADDED PASSENGER'S BY SEARCH METHOD'S <---------->
1
FLIGHT ARRIVAL DETAILS ARE--------
-----------------------------------
name of flight is----AIRINDIA
id of flight is------456321
address of flight is------LKO TO ASR
time of arrival is-------11:54-PM
fare of this flight is------4512.63
arrival count is--------->1
-----------------------------------
FLIGHT ARRIVAL DETAILS ARE--------
-----------------------------------
name of flight is----JETAIRWAYS
id of flight is------458421
address of flight is------SIWAN TO ASR
time of arrival is-------12:45-AM
fare of this flight is------84521.32
arrival count is--------->2
-----------------------------------
DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO----- 1
CHOOSE YOUR SPECIFIC OPERATION---------
1.) ARRIVAL'S--------
2.) DEPARTURE'S-------
3.) ENQUIRY'S---------
4.) SHOW ADDED PASSENGER'S BY SEARCH METHOD'S <---------->
2
FIRST FLIGHT DEPARTED DELAY WITH 1 HOURS
FLIGHT DEPARTED DETAILS ARE--------
-----------------------------------
name of flight is----INDIGO
id of flight is------145266
address of flight is------PATNA TO GORAKHPUR
time of departure is-------13:26-PM
fare of this flight is------7865.3254
departure count is--------->1
-----------------------------------
FLIGHT DEPARTED DETAILS ARE--------
-----------------------------------
name of flight is----GOAIR
id of flight is------564789
address of flight is------SIWAN TO BANGALORE
time of departure is-------16:55-PM
fare of this flight is------2865.8754
departure count is--------->0
-----------------------------------
DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO----- 1
CHOOSE YOUR SPECIFIC OPERATION---------
1.) ARRIVAL'S--------
2.) DEPARTURE'S-------
3.) ENQUIRY'S---------
4.) SHOW ADDED PASSENGER'S BY SEARCH METHOD'S <---------->
3
ENTER CURRENT AIRPORT STATION TO FLY<---------->
AMRITSAR
-------SEATS AVAILABLE------
-----------------------------------
name of flight is----EMIRATES
id of flight is------456327
address of flight is------AMRITSAR TO SIWAN
time of departure is-------12:45-AM
fare of this flight is------4562.84
STATUS OF CONFIRMATION IS--------->AVAILABLE
-----------------------------------
DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO----- 1
CHOOSE YOUR SPECIFIC OPERATION---------
1.) ARRIVAL'S--------
2.) DEPARTURE'S-------
3.) ENQUIRY'S---------
4.) SHOW ADDED PASSENGER'S BY SEARCH METHOD'S <---------->
4
THIS IS PASSENGER'S RECORD'S AREA------ >>
PASSENGER SUCCESSFULLY ENTERED IN DATABASE------
----------->>PASSENGER'S DETAILS ARE------------ >>
FULL NAME IS-------AMIT
PASSENGER'S AGE----------19
PASSENGER'S ADDRESS-----SIWAN
FLIGHT TIMING IS---------10:05-PM
JOURNEY FROM AND TO---------LKO TO ASR
FLIGHT ID IS-----------12345
TOTAL FARE OF JOURNEY IS-------5632.21
-----HAPPY JOURNEY---------
DO YOU WANT TO CONTINUE PRESS 1 FOR YES OTHER KEY FOR NO----- 2
Compilation Terminated -----
Process finished with exit code 0
#StayHome Be Safe Don't Go To The Outside Due To COVID-19 Or CORONAVIRUS ......
THANK YOU !!!!!!!!!!!
0 Comments
Write your comments or feedback here.........