Computer Project
Computer Project
*;
import java.lang.*;
import java.io.*;
import java.time.format.DateTimeFormatter;
import java.time.LocalTime;
import java.time.LocalDate;
class project
{
public static void main(String args[])throws IOException
{
for(;;){
System.out.print("\f");
System.out.flush();
char seatrowchar;
int
distanceforcab,lengthofnumber=0,adult=0,ch=0,persons,transporttype,me,i,seatnumber,seatarrangement,classtype,transportc
ompany,seatrow,timeadder=3,comparingdates=0,paymentchoice=0,cvv,pin,UPIpin,pinlength=0,UPIpinlength=0;
long phonenumber,distance=0;
String
mail,password,lengthchk,source,destination,bill,cab,classtypestring,meals="",timenow,transporttypestring,datetoday="",dateo
ftravelling="",bookagain,UPIid,pinstring="",UPIpinstring="",giftcardid;
double totalfare,mealfare=0.0;
String[] name=new String[10];
int[] age=new int[11];
String[] departuretime=new String[11]; /*decalring all the variables needed*/
String[] arrivaltime=new String[11];
String[] gender=new String[11];
int[] hour=new int[11];
int[] minute=new int[11];
int[] genderchoice=new int[11];
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner in=new Scanner(System.in);
Random seat=new Random();
System.out.println("WELCOME TO Delta travels");
System.out.println("Enter email:");
mail=in.nextLine();
for(;;){
if(mail.equals("[email protected]")){
break;}
else{
System.out.println("Invalid Email!! Please enter again");
mail=in.nextLine();}} //accepting mail and password
System.out.println("Enter passcode :");
password=in.nextLine();
for(;;){
if(password.equals("mspa.project")){
break;}
else{
System.out.println("Invalid passcode!! Please enter again");
password=in.nextLine();}}
System.out.print("\f");
System.out.flush();
System.out.println("Gender of "+name[i]);
System.out.println("1.Male");
System.out.println("2.Female");
System.out.println("3.Other");
genderchoice[i]=in.nextInt();
System.out.print("\f");
System.out.flush();
for(;;){
if(genderchoice[i]>3||genderchoice[i]<1){
System.out.println("Invalid choice!! please enter again");
genderchoice[i]=in.nextInt();}
else{
break;}}
if(genderchoice[i]==1){
gender[i]="Male";}
else if(genderchoice[i]==2){
gender[i]="Female";}
else if(genderchoice[i]==3){
gender[i]="Other";}
}
System.out.print("\f");
System.out.flush();
System.out.println("Do want meals along ur journey?");
meals=in.next(); //accepting user's choice for meals
System.out.print("\f");
System.out.flush();
seatarrangement=1;
if(persons>1){
System.out.println("1.Scattered seats");
System.out.println("2.adjacent seats"); //accepting user's choice for seat arrangement
seatarrangement=in.nextInt();
for(;;){
if(seatarrangement>2||seatarrangement<1){
System.out.println("Invalid choice!! Please enter again");
seatarrangement=in.nextInt();}
if(seatarrangement<3&&seatarrangement>0){
break;}}}
System.out.print("\f");
System.out.flush();
if(persons>10){
System.out.println("Only 10 bookings are allowed once");}
else{
System.out.println("Choose a comfortable mode of transport for yourself");
System.out.println("1.Plane");
System.out.println("2.Train"); //accepting user's transport choice
System.out.println("3.Bus");
transporttype=0;
transporttypestring=in.next();
if(transporttypestring.equalsIgnoreCase("plane")||transporttypestring.equalsIgnoreCase("1")){
transporttype=1;}
else if(transporttypestring.equalsIgnoreCase("train")||transporttypestring.equalsIgnoreCase("2")){
transporttype=2;}
else if(transporttypestring.equalsIgnoreCase("bus")||transporttypestring.equalsIgnoreCase("3")){
transporttype=3;}
System.out.print("\f");
System.out.flush();
for(;;){
if(transporttype>3||transporttype<1){
System.out.println("Invalid choice!! Please enter again");
transporttype=in.nextInt();
System.out.print("\f");
System.out.flush();
}
else{
break;}}
switch(transporttype)
{
case 1:System.out.println("1.Economy class or 2.Buisness class?"); //accepting user's class choice
classtype=in.nextInt();
System.out.print("\f");
System.out.flush();
for(;;){
if(classtype==1||classtype==2)
break;
else{
System.out.println("Invalid choice!! Please enter again");
classtype=in.nextInt();}
}
timeadder=timeadder+0;
for(i=1;i<=10;i++){ //getting 10 random departure times and adding time taken to get arrival time
hour[i]=seat.nextInt(23)+1;
minute[i]=seat.nextInt(60);
LocalTime timeoftransport=LocalTime.of(hour[i],minute[i]);
DateTimeFormatter transportformatter=DateTimeFormatter.ofPattern("hh:mm a");
departuretime[i]=timeoftransport.format(transportformatter);
LocalTime timeoftransport2=timeoftransport.plusHours(timeadder);
arrivaltime[i]=timeoftransport2.format(transportformatter);
}
System.out.println("10 Flights Available !!");
System.out.println("1.Indigo Flight(586778) from "+source+" to "+destination+" departs at - "+departuretime[1]+"
reaches at - "+arrivaltime[1]);
System.out.println("2.Spice Jet Flight(409036) from "+source+" to "+destination+" departs at -
"+departuretime[2]+" reaches at - "+arrivaltime[2]);
System.out.println("3.Air India Flight(479832) from "+source+" to "+destination+" departs at -
"+departuretime[3]+" reaches at - "+arrivaltime[3]);
System.out.println("4.Vistara Flight(4326897) from "+source+" to "+destination+" departs at -
"+departuretime[4]+" reaches at - "+arrivaltime[4]);
System.out.println("5.Go Air Flight(345678) from "+source+" to "+destination+" departs at - "+departuretime[5]+"
reaches at - "+arrivaltime[5]);
System.out.println("6.Air Asia India Flight(768598) from "+source+" to "+destination+" departs at -
"+departuretime[6]+" reaches at - "+arrivaltime[6]);
System.out.println("7.Air India Express Flight(342678) from "+source+" to "+destination+" departs at -
"+departuretime[7]+" reaches at - "+arrivaltime[7]);
System.out.println("8.Alliance Air Flight(754789) from "+source+" to "+destination+" departs at -
"+departuretime[8]+" reaches at - "+arrivaltime[8]);
System.out.println("9.Tru Jet Flight(657980) from "+source+" to "+destination+" departs at -
"+departuretime[9]+" reaches at - "+arrivaltime[9]);
System.out.println("10.Star Air Flight(324698) from "+source+" to "+destination+" departs at -
"+departuretime[10]+" reaches at - "+arrivaltime[10]);
transportcompany=in.nextInt(); //displaying and accepting transport companies
System.out.print("\f");
System.out.flush();
for(;;){
if(transportcompany>10||transportcompany<1){
System.out.println("You have entered the wrong choice, please enter again");
transportcompany=in.nextInt();}
else{
break;}}
switch(transportcompany)
{ //calculating fare based on user's choice
case 1:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*3);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*15);
break;
default:System.out.println("Error ");
return;
}
break;
case 2:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*3);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*15);
break;
default:System.out.println("Error ");
return;
}
break;
case 3:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*5);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 4:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*6);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*25);
break;
default:System.out.println("Error ");
return;
}
break;
case 5:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*5);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 6:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*4);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 7:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*5);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*15);
break;
default:System.out.println("Error ");
return;
}
break;
case 8:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*3);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 9:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*3);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*15);
break;
default:System.out.println("Error ");
return;
}
break;
case 10:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*5);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
default:System.out.println("Error ");
return;
}
break;
case 2: System.out.println("1.Sleeper coach or 2.A/C coach?");
classtype=in.nextInt();
System.out.print("\f");
System.out.flush();
for(;;){
if(transporttype>3||transporttype<1){
System.out.println("Invalid choice!! Please enter again");
transporttype=in.nextInt();
System.out.print("\f");
System.out.flush();
}
if(transporttype<4&&transporttype>0){
break;}}
for(i=1;i<=10;i++){
hour[i]=seat.nextInt(23)+1;
minute[i]=seat.nextInt(60);
LocalTime timeoftransport=LocalTime.of(hour[i],minute[i]);
DateTimeFormatter transportformatter=DateTimeFormatter.ofPattern("hh:mm a");
departuretime[i]=timeoftransport.format(transportformatter);
LocalTime timeoftransport2=timeoftransport.plusHours(timeadder);
arrivaltime[i]=timeoftransport2.format(transportformatter);
}
System.out.println("10 Trains Available !!");
System.out.println("1.Rajdhani Express (564534) from "+source+" to "+destination+" departs at -
"+departuretime[1]+" reaches at - "+arrivaltime[1]);
System.out.println("2.Shatabdi Express (543219) from "+source+" to "+destination+" departs at -
"+departuretime[2]+" reaches at - "+arrivaltime[2]);
System.out.println("3.Duronto Express (423568) from "+source+" to "+destination+" departs at -
"+departuretime[3]+" reaches at - "+arrivaltime[3]);
System.out.println("4.Gatimaan Express (342789) from "+source+" to "+destination+" departs at -
"+departuretime[4]+" reaches at - "+arrivaltime[4]);
System.out.println("5.Tejas Express (563729) from "+source+" to "+destination+" departs at -
"+departuretime[5]+" reaches at - "+arrivaltime[5]);
System.out.println("6.Humsafar Express (437890) from "+source+" to "+destination+" departs at -
"+departuretime[6]+" reaches at - "+arrivaltime[6]);
System.out.println("7.Antyodaya Express (456779) from "+source+" to "+destination+" departs at -
"+departuretime[7]+" reaches at - "+arrivaltime[7]);
System.out.println("8.Vande Bharat Express (563248) from "+source+" to "+destination+" departs at -
"+departuretime[8]+" reaches at - "+arrivaltime[8]);
System.out.println("9.Sampark Kranti Express (573428) from "+source+" to "+destination+" departs at -
"+departuretime[9]+" reaches at - "+arrivaltime[9]);
System.out.println("10.Jan Shatabdi Express (415367) from "+source+" to "+destination+" departs at -
"+departuretime[10]+" reaches at - "+arrivaltime[10]);
transportcompany=in.nextInt();
System.out.print("\f");
System.out.flush();
for(;;){
if(transportcompany>10||transportcompany<1){
System.out.println("You have entered the wrong choice, please enter again");
transportcompany=in.nextInt();
System.out.print("\f");
System.out.flush();
}
else{
break;}}
switch(transportcompany)
{
case 1:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.30);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*0.80);
break;
default:System.out.println("Error ");
return;
}
break;
case 2:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.40);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.20);
break;
default:System.out.println("Error ");
return;
}
break;
case 3:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.40);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.30);
break;
default:System.out.println("Error ");
return;
}
break;
case 4:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.40);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.30);
break;
default:System.out.println("Error ");
return;
}
break;
case 5:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.30);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.40);
break;
default:System.out.println("Error ");
return;
}
break;
case 6:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.35);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.20);
break;
default:System.out.println("Error ");
return;
}
break;
case 7:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.35);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.35);
break;
default:System.out.println("Error ");
return;
}
break;
case 8:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.50);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.50);
break;
default:System.out.println("Error ");
return;
}
break;
case 9:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.25);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*1.20);
break;
default:System.out.println("Error ");
return;
}
break;
case 10:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*0.25);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*0.80);
break;
default:System.out.println("Error ");
return;
}
break;
default:System.out.println("Error ");
return;
}
break;
for(;;){
if(transporttype>3||transporttype<1){
System.out.println("Invalid choice!! Please enter again");
transporttype=in.nextInt();
System.out.print("\f");
System.out.flush();
}
else{
break;}}
for(i=1;i<=10;i++){
hour[i]=seat.nextInt(23)+1;
minute[i]=seat.nextInt(60);
LocalTime timeoftransport=LocalTime.of(hour[i],minute[i]);
DateTimeFormatter transportformatter=DateTimeFormatter.ofPattern("hh:mm a");
departuretime[i]=timeoftransport.format(transportformatter);
LocalTime timeoftransport2=timeoftransport.plusHours(timeadder);
arrivaltime[i]=timeoftransport2.format(transportformatter);
}
System.out.println("10 Buses Available !!");
System.out.println("1.RedBus (789567) from "+source+" to "+destination+" departs at - "+departuretime[1]+"
reaches at - "+arrivaltime[1]);
System.out.println("2.AbhiBus (754343) from "+source+" to "+destination+" departs at - "+departuretime[2]+"
reaches at - "+arrivaltime[2]);
System.out.println("3.MakeMyTrip (765637) from "+source+" to "+destination+" departs at -
"+departuretime[3]+" reaches at - "+arrivaltime[3]);
System.out.println("4.Yatra (648546) from "+source+" to "+destination+" departs at - "+departuretime[4]+"
reaches at - "+arrivaltime[4]);
System.out.println("5.Goibibo (676572) from "+source+" to "+destination+" departs at - "+departuretime[5]+"
reaches at - "+arrivaltime[5]);
System.out.println("6.Travelyaari (534626) from "+source+" to "+destination+" departs at - "+departuretime[6]+"
reaches at - "+arrivaltime[6]);
System.out.println("7.TicketGoose (947653) from "+source+" to "+destination+" departs at -
"+departuretime[7]+" reaches at - "+arrivaltime[7]);
System.out.println("8.Parveen Travels (553467) from "+source+" to "+destination+" departs at -
"+departuretime[8]+" reaches at - "+arrivaltime[8]);
System.out.println("9.SRS Travels (567889) from "+source+" to "+destination+" departs at - "+departuretime[9]+"
reaches at - "+arrivaltime[9]);
System.out.println("10.Kalladulta Travels (342565) from "+source+" to "+destination+" departs at -
"+departuretime[10]+" reaches at - "+arrivaltime[10]);
transportcompany=in.nextInt();
System.out.print("\f");
System.out.flush();
for(;;){
if(transportcompany>10||transportcompany<1){
System.out.println("You have entered the wrong choice, please enter again");
transportcompany=in.nextInt();}
if(transportcompany<11&&transportcompany>0){
break;}}
switch(transportcompany)
{
case 1:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*20);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*30);
break;
default:System.out.println("Error ");
return;
}
break;
case 2:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 3:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*30);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*50);
break;
default:System.out.println("Error ");
return;
}
break;
case 4:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 5:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*30);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*40);
break;
default:System.out.println("Error ");
return;
}
break;
case 6:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 7:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 8:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
default:System.out.println("Error ");
return;
}
break;
case 9:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
case 10:switch(classtype)
{
case 1:totalfare=(adult+(ch*0.5))*(distance*10);
break;
case 2:totalfare=(adult+(ch*0.5))*(distance*20);
break;
default:System.out.println("Error ");
return;
}
break;
default:System.out.println("Error ");
return;
}
break;
default:System.out.println("Error ");
return;
}
if(meals.equalsIgnoreCase("yes")||meals.equalsIgnoreCase("yup")){
mealfare=totalfare*10/100; //adding meal fare in the total fare if user wants meals too
System.out.println("price of meal : "+mealfare);
totalfare=totalfare+mealfare;}
System.out.println("Do you want a cab till your hotel?(Rs. 20 per Km)");
cab=in.next();
System.out.print("\f");
System.out.flush();
distanceforcab=0;
if(cab.equalsIgnoreCase("yes")||cab.equalsIgnoreCase("yup")){
System.out.println("Enter Distance in Km till your hotel");
distanceforcab=in.nextInt(); //accepting user's choice for cab service
System.out.print("\f");
System.out.flush();
totalfare=totalfare+(20*distanceforcab);
}
System.out.println("Your travel cost would be ₹"+totalfare+", do you want to proceed paying?");
bill=in.next();
System.out.print("\f"); //accepting user's confirmation to accept payment & generate bill
System.out.flush();
if(bill.equalsIgnoreCase("yes")||bill.equalsIgnoreCase("yup")){
System.out.println("Choose a mode of payment :");
System.out.println("1. Credit/Debit card");
System.out.println("2. Google pay,Paytm,Phonepe etc");
System.out.println("3. Gift card");
paymentchoice=in.nextInt();
for(;;)
{
if(paymentchoice>0&&paymentchoice<=3)
break;
else
System.out.println("Invalid choice, enter again!");
paymentchoice=in.nextInt();
}
switch(paymentchoice)
{
case 1 :System.out.println("Enter your CVV");
cvv=in.nextInt();
System.out.println("Enter your four digit pin");
pin=in.nextInt();
for(;;)
{
pinstring=Long.toString(pin);
pinlength=pinstring.length();
if(pinlength==4)
break;
else
System.out.println("The is pin is not four digits, please enter again");
pin=in.nextInt();
}
break;
case 2 :System.out.println("Enter you UPI id");
UPIid=in.next();
System.out.println("Enter your 4 digit UPI pin");
UPIpin=in.nextInt();
for(;;)
{
UPIpinstring=Long.toString(UPIpin);
UPIpinlength=UPIpinstring.length();
if(UPIpinlength==4)
break;
else
System.out.println("The is pin is not four digits, please enter again");
UPIpin=in.nextInt();
}
break;
case 3 :System.out.println("Enter gift card id");
giftcardid=in.next();
break;
default :System.out.println("Error");
}
System.out.println("Transaction sucessful!!");
source=source.toUpperCase();
destination=destination.toUpperCase();
System.out.print("\f");
System.out.flush();
//displaying the bill
System.out.println(" BILL");
System.out.println("Source : "+source);
System.out.println("Destination : "+destination);
if(transporttype==1){
totalfare=totalfare+0;
if(transportcompany==1){
System.out.println("Indigo Flight(586778) from "+source+" to "+destination);
System.out.println("Flight Number : 586778");
}
else if(transportcompany==2){
System.out.println("Spice Jet Flight(409036) from "+source+" to "+destination);
System.out.println("Flight Number : 409036");
}
else if(transportcompany==3){
System.out.println("Air India Flight(479832) from "+source+" to "+destination);
System.out.println("Flight Number : 479832");
}
else if(transportcompany==4){
System.out.println("Vistara Flight(432689) from "+source+" to "+destination);
System.out.println("Flight Number : 432689");
}
else if(transportcompany==5){
System.out.println("Go Air Flight(345678) from "+source+" to "+destination);
System.out.println("Flight Number : 345678");
}
else if(transportcompany==6){
System.out.println("Air Asia India Flight(768598) from "+source+" to "+destination);
System.out.println("Flight Number : 768598");
}
else if(transportcompany==7){
System.out.println("Air India Express Flight(342678) from "+source+" to "+destination);
System.out.println("Flight Number : 342678");
}
else if(transportcompany==8){
System.out.println("Alliance Air Flight(754789) from "+source+" to "+destination);
System.out.println("Flight Number : 754789");
}
else if(transportcompany==9){
System.out.println("Tru Jet Flight(657980) from "+source+" to "+destination);
System.out.println("Flight Number : 657980");
}
else if(transportcompany==10){
System.out.println("Star Air Flight(324698) from "+source+" to "+destination);
System.out.println("Flight Number : 324698");
}
else if(transporttype==2){
totalfare=totalfare+0;
if(transportcompany==1){
System.out.println("Rajdhani Express (564534) from "+source+" to "+destination);
System.out.println("Train Number : 564534");
}
else if(transportcompany==2){
System.out.println("Shatabdi Express (543219) from "+source+" to "+destination);
System.out.println("Train Number : 543219");
}
else if(transportcompany==3){
System.out.println("Duronto Express (423568) from "+source+" to "+destination);
System.out.println("Train Number : 423568");
}
else if(transportcompany==4){
System.out.println("Gatimaan Express (342789) from "+source+" to "+destination);
System.out.println("Train Number : 342789");
}
else if(transportcompany==5){
System.out.println("Tejas Express (563729) from "+source+" to "+destination);
System.out.println("Train Number : 563729");
}
else if(transportcompany==6){
System.out.println("Humsafar Express (437890) from "+source+" to "+destination);
System.out.println("Train Number : 437890");
}
else if(transportcompany==7){
System.out.println("Antyodaya Express (456779) from "+source+" to "+destination);
System.out.println("Train Number : 456779");
}
else if(transportcompany==8){
System.out.println("Vande Bharat Express (563248) from "+source+" to "+destination);
System.out.println("Train Number : 563248");}
else if(transportcompany==9){
if(transportcompany==1){
System.out.println("RedBus (789567) from "+source+" to "+destination);
System.out.println("Bus Number : 789567");}
else if(transportcompany==2){
System.out.println("AbhiBus (754343) from "+source+" to "+destination);
System.out.println("Bus Number : 754343");}
else if(transportcompany==3){
System.out.println("MakeMyTrip (765637) from "+source+" to "+destination);
System.out.println("Bus Number : 765637");}
else if(transportcompany==4){
System.out.println("Yatra (648546) from "+source+" to "+destination);
System.out.println("Bus Number : 648546");}
else if(transportcompany==5){
System.out.println("Goibibo (676572) from "+source+" to "+destination);
System.out.println("Bus Number : 676572");}
else if(transportcompany==6){
System.out.println("Travelyaari (534626) from "+source+" to "+destination);
System.out.println("Bus Number : 534626");}
else if(transportcompany==7){
System.out.println("TicketGoose (947653) from "+source+" to "+destination);
System.out.println("Bus Number : 947653");}
else if(transportcompany==8){
System.out.println("Parveen Travels (553467) from "+source+" to "+destination);
System.out.println("Bus Number : 553467");}
else if(transportcompany==9){
System.out.println("SRS Travels (567889) from "+source+" to "+destination);
System.out.println("Bus Number : 567889");}
else if(transportcompany==10){
System.out.println("Kallada Travels (342565) from "+source+" to "+destination);
System.out.println("Bus Number : 342565");}
return;
}
}
classtypestring="";
if(transporttype==1){
System.out.println("Distance to be travelled by Air : "+distance+"Km");
if(classtype==2){
classtypestring="Buissness Class";
System.out.println("Type of Class : "+classtypestring);}
else{
classtypestring="Economy Class";
System.out.println("Type of Class : "+classtypestring);}}
if(transporttype==2){
System.out.println("Distance to be travelled by Railways : "+distance+"Km");
if(classtype==1){
classtypestring="Sleeper Coach";
System.out.println("Type of coach : "+classtypestring);}
else{
classtypestring="A/C Coach";
System.out.println("Type of coach : "+classtypestring);}}
if(transporttype==3){
System.out.println("Distance to be travelled by Roadult : "+distance+"Km");
if(classtype==1){
classtypestring="Sleeper Coach";
System.out.println("Type of bus : "+classtypestring);}
if(cab.equalsIgnoreCase("yes")||cab.equalsIgnoreCase("yup")){
System.out.println("Distance travelled by cab : "+distanceforcab+"Km");}
}
for(i=1;i<=persons;i++){
System.out.println("Name of passenger "+i+" is : "+name[i]);
System.out.println("Age of "+name[i]+" is : "+age[i]);
System.out.println("Gender of "+name[i]+" is : "+gender[i]);}
if(seatarrangement==1){
totalfare=totalfare+0;
for(i=1;i<=persons;i++){
seatrow=seat.nextInt(7)+65;
seatrowchar=(char)seatrow;
seatnumber=seat.nextInt(60)+1;
System.out.println(name[i]+" has seat number : "+seatrowchar+seatnumber+" in "+classtypestring);}
}
else if(seatarrangement==2){totalfare=totalfare+0;
seatrow=seat.nextInt(7)+65;
seatrowchar=(char)seatrow;
seatnumber=seat.nextInt(60)+1;
for(i=1;i<=persons;i++){
System.out.println(name[i]+" has seat number : "+seatrowchar+seatnumber+" in "+classtypestring
);
seatnumber=seatnumber+1;
}
}
System.out.println("Number of adults/teens : "+adult);
System.out.println("Number of Children/tweens : "+ch);
LocalTime time=LocalTime.now();
DateTimeFormatter formatoftime=DateTimeFormatter.ofPattern("hh:mm:ss a");
timenow=time.format(formatoftime);
System.out.println("Arrival Time : "+departuretime[transportcompany]);
System.out.println("Reaching Time : "+arrivaltime[transportcompany]);
System.out.println("Date of Booking : "+datetoday);
System.out.println("Time of Booking : "+timenow);
System.out.println("Date of travelling : "+dateoftravelling);
System.out.println(" -------");
System.out.println("Total Fare =
₹"+totalfare);
System.out.println("Thank you for visting Delta travels.com!!");
System.out.println("Do you want to book again?");
bookagain=in.next();
if(bookagain.equalsIgnoreCase("no")){
System.out.println("Thank you for visting Delta travels.com!!");
break;}}
else{ System.out.println("Do you want to book again?");
bookagain=in.next();
if(bookagain.equalsIgnoreCase("no")){
System.out.println("Thank you for visting Delta travels.com!!");
break;}}
}
}
}
}