package coreservlets;
/** A catalog listing the items available in inventory.
*
* Taken from Core Servlets and JavaServer Pages
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2000 Marty Hall; may be freely used or adapted.
*/
public class Catalog {
// This would come from a database in real life
private static Item[] items =
{ new Item("hall001",
"Core Servlets and JavaServer Pages " +
" by Marty Hall",
"The definitive reference on servlets " +
"and JSP from Prentice Hall and \n" +
"Sun Microsystems Press. Nominated for " +
"the Nobel Prize in Literature.",
39.95),
new Item("hall002",
"Core Web Programming, Java2 Edition " +
"by Marty Hall, Larry Brown, and " +
"Paul McNamee",
"One stop shopping for the Web programmer. " +
"Topics include \n" +
"
- Thorough coverage of Java 2; " +
"including Threads, Networking, Swing, \n" +
"Java2D, and Collections\n" +
"
- A fast introduction to HTML 4.01, " +
"including frames, style sheets, layers,\n" +
"and Netscape and Internet Explorer " +
"extensions.\n" +
"
- A fast introduction to HTTP 1.1, " +
"servlets, and JavaServer Pages.\n" +
"
- A quick overview of JavaScript 1.2\n" +
"
",
49.95),
new Item("lewis001",
"The Chronicles of Narnia by C.S. Lewis",
"The classic children's adventure pitting " +
"Aslan the Great Lion and his followers\n" +
"against the White Witch and the forces " +
"of evil. Dragons, magicians, quests, \n" +
"and talking animals wound around a deep " +
"spiritual allegory. Series includes\n" +
"The Magician's Nephew,\n" +
"The Lion, the Witch and the " +
"Wardrobe,\n" +
"The Horse and His Boy,\n" +
"Prince Caspian,\n" +
"The Voyage of the Dawn " +
"Treader,\n" +
"The Silver Chair, and \n" +
"The Last Battle.",
19.95),
new Item("alexander001",
"The Prydain Series by Lloyd Alexander",
"Humble pig-keeper Taran joins mighty " +
"Lord Gwydion in his battle against\n" +
"Arawn the Lord of Annuvin. Joined by " +
"his loyal friends the beautiful princess\n" +
"Eilonwy, wannabe bard Fflewddur Fflam," +
"and furry half-man Gurgi, Taran discovers " +
"courage, nobility, and other values along\n" +
"the way. Series includes\n" +
"The Book of Three,\n" +
"The Black Cauldron,\n" +
"The Castle of Llyr,\n" +
"Taran Wanderer, and\n" +
"The High King.",
19.95),
new Item("rowling001",
"The Harry Potter Trilogy by " +
"J.K. Rowling",
"The first three of the popular stories " +
"about wizard-in-training Harry Potter\n" +
"topped both the adult and children's " +
"best-seller lists. Series includes\n" +
"Harry Potter and the " +
"Sorcerer's Stone,\n" +
"Harry Potter and the " +
"Chamber of Secrets, and\n" +
"Harry Potter and the " +
"Prisoner of Azkaban.",
25.95)
};
public static Item getItem(String itemID) {
Item item;
if (itemID == null) {
return(null);
}
for(int i=0; i