Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
15.2 Example: An On Line Travel Agent
369
Listing 15.5 TravelCustomer.java (continued)
public void setOrigin(String origin) {
this.origin = origin;
}
public String getDestination() {
return(destination);
}
public void setDestination(String destination) {
this.destination = destination;
}
public FrequentFlyerInfo[] getFrequentFlyerData() {
return(frequentFlyerData);
}
public void setFrequentFlyerData(FrequentFlyerInfo[]
frequentFlyerData) {
this.frequentFlyerData = frequentFlyerData;
}
public String getFrequentFlyerTable() {
FrequentFlyerInfo[] frequentFlyerData =
getFrequentFlyerData();
if (frequentFlyerData.length == 0) {
return("No frequent flyer data recorded.");
} else {
String table =
"\n" +
" Airline | Frequent Flyer Number\n";
for(int i=0; i
FrequentFlyerInfo info = frequentFlyerData[i];
table = table +
"" +
"" + info.getAirlineName() +
"" + info.getFrequentFlyerNumber() + "\n";
}
table = table + " | | |
---|
\n";
return(table);
}
}
public RentalCarInfo[] getRentalCarData() {
return(rentalCarData);
}
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