Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
9.4 An On Line Store Using a Shopping Cart and Session Tracking
225
Listing 9.8 ItemOrder.java (continued)
  public void incrementNumItems() {
    setNumItems(getNumItems() + 1);
  }
  public void cancelOrder() {
    setNumItems(0);
  }
  public double getTotalCost() {
    return(getNumItems() * getUnitCost());
  }
}
Listing 9.9 Catalog.java 
package coreservlets;
/** A catalog listing the items available in inventory. */
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" +
                 "
                 "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" +
    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
    
    
    
    
    

     

     

     

     

     Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

    jsp web hosting

     

    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