Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
15.2 Example: An On Line Travel Agent
371
Listing 15.5 TravelCustomer.java (continued)
flightString =
flightString + getFlightDescription(flightInfo[0],
flightInfo[1],
flightInfo[2],
flightInfo[3],
flightInfo[4],
flightInfo[5],
flightInfo[6],
flightOrigin,
flightDestination,
flightStartDate,
flightEndDate);
}
return(flightString);
}
private String getFlightDescription(String airline,
String flightNum,
String price,
String stop1,
String stop2,
String time1,
String time2,
String flightOrigin,
String flightDestination,
String flightStartDate,
String flightEndDate) {
String flight =
"
\n" +
"\n" +
"" + airline + " Flight " + flightNum +
" ($" + price + ") |
---|
\n" +
"Outgoing: Leaves " + flightOrigin +
" at " + time1 + " AM on " + flightStartDate +
", arriving in " + flightDestination +
" at " + time2 + " PM (1 stop " + stop1 + ").\n" +
"
\n" +
"Return: Leaves " + flightDestination +
" at " + time1 + " AM on " + flightEndDate +
", arriving in " + flightOrigin +
" at " + time2 + " PM (1 stop " + stop2 + ").\n";
return(flight);
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved