Please modify the follow source code to also include the following:
1. Add two more flights from these two airlines: United and AA, and makeup all the related information. Make sure the user can pick those flight numbers (United & AA) form the prompt box.
2. Add an array to hold "Departure Time" for all the flights. (Time format: "0800A", "1135P" ...)
3. If the user type in a flight number is not in the flight record, send out a flight number not found message using alert(), don't print out any flight information and stop the program.
Code to be modified (copy and pasted from notepad++):
<html>
<head>
<title>Flying from Boston</title>
<script language="javascript">
<!-- hide script away from browsers
function flightInfo(got) {
//obtain flight info
for (i=0; i<6; i++) {
if (got == flightNumber[i])
break;
}//for
//print results
document.write("Here is your flight
info:<br />");
document.write("Airline: " +
airline[i] + "<br />");
document.write("Flight Number: " +
flightNumber[i] + "<br />");
document.write("Terminal: " +
terminal[i] + "<br />");
document.write("Gate: " + gate[i] +
"<br />");
document.write("If your flight
departure time is 1/2 hr from now, please proceed to gate.
<br/>");
document.write("Thank you for
choosing our airline. Have a safe and pleasnat trip.
<br/>");
}//flightInof()
//define flight data
airline = ["Lufthanza", "Swiss Air", "USAir", "Delta", "British
Airways", "Air France"];
flightNumber = [356, 89, 1230, 952, 513, 910];
terminal = ["E", "D", "A", "C", "B", "F"];
gate = [5, 10, 3, 7, 1, 8];
//traveler flight
input = prompt("Please, select your flight numer: 356, 89, 1230,
952, 513, or 910", "356");
flightInfo(input);
-->
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<title>Flying from Boston</title>
<script language="javascript">
<!-- hide script away from browsers
function flightInfo(got) {
//obtain flight info
var index;
for (i=0; i<8; i++) {
if (got ==
flightNumber[i])
{
index=i;
break;
}
}//for
if(index!=undefined)
{
//print results
document.write("Here is your
flight info:<br />");
document.write("Airline: " +
airline[i] + "<br />");
document.write("Flight Number:
" + flightNumber[i] + "<br />");
document.write("Terminal: " +
terminal[i] + "<br />");
document.write("Gate: " +
gate[i] + "<br />");
document.write("Departure
Time: " + departure_time[i] + "<br />");
document.write("If your flight
departure time is 1/2 hr from now, please proceed to gate.
<br/>");
document.write("Thank you for
choosing our airline. Have a safe and pleasnat trip.
<br/>");
}
else
{
alert('flight number not found
');
}
}//flightInof()
//define flight data
airline = ["Lufthanza", "Swiss Air", "USAir", "Delta", "British
Airways", "Air France","United","AA"];
flightNumber = [356, 89, 1230, 952, 513, 910,123,456];
terminal = ["E", "D", "A", "C", "B", "F","G","H"];
gate = [5, 10, 3, 7, 1, 8,2,3];
departure_time=["0800A", "1135P","0800A", "1135P","0800A",
"1135P","0800A", "1135P"];
//traveler flight
input = prompt("Please, select your flight numer: 356, 89, 1230,
952, 513, or 910", "356");
flightInfo(input);
-->
</script>
</head>
<body>
</body>
</html>
Please modify the follow source code to also include the following: 1. Add two more flights...