@@ -0,0 +1,2689 @@
+import java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.annotation.WebServlet;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport javax.servlet.http.HttpSession;%0Aimport java.util.HashMap;%0A@WebServlet(%22/addtocart%22)%0Apublic class Addtocart extends HttpServlet %7B%0A    protected void doGet(HttpServletRequest request, HttpServletResponse response)%0A            throws ServletException, IOException %7B%0A        response.setContentType(%22text/html;charset=UTF-8%22);%0A        HttpSession session = request.getSession();%0A        cart shoppingCart;%0A        shoppingCart = (cart) session.getAttribute(%22cart%22);%0A        if(shoppingCart == null)%7B%0A          shoppingCart = new cart();%0A          session.setAttribute(%22cart%22, shoppingCart);%0A        %7D%0A        String name = request.getParameter(%22name%22);%0A        String d_key = request.getParameter(%22key%22);%0A        String s2=request.getParameter(%22delete%22);%0A        /*if(s2.equals(%22delete%22))%7B%0A        %09shoppingCart.deleteFromCart(d_key);%0A        %09//update%0A        %09session.setAttribute(%22cart%22, shoppingCart);%0A        %09// now fetch%0A        %09shoppingCart = (cart) session.getAttribute(%22cart%22);%0A        %7D*/%0A        Integer price = Integer.parseInt(request.getParameter(%22price%22));%0A        shoppingCart.addToCart(name, price);%0A        session.setAttribute(%22cart%22, shoppingCart);%0A        try (PrintWriter out = response.getWriter()) %7B%0A            /* TODO output your page here. You may use following sample code. */%0A            out.println(%22%3C!DOCTYPE html%3E%22);%0A            out.println(%22%3Chtml%3E%22);%0A            out.println(%22%3Chead%3E%22);%0A            out.println(%22%3Ctitle%3EItem Deleted%3C/title%3E%22);            %0A            out.println(%22%3C/head%3E%22);%0A            out.println(%22%3Cbody%3E%22);%0A            out.println(%22%3Ch1%3EPizza successfully added to cart %3C/h1%3E%22);%0A            out.println(%22%3Cform action='index.html'%3EAdd more pizza item%3Cbr/%3E%3Cinput type='submit' value='go'%3E%3C/form%3E%22);%0A            out.println(%22%3Chr%3E%22);%0A            out.println(%22%3Ch2%3ECart%3C/h2%3E%22);%0A            HashMap%3CString, Integer%3E items = shoppingCart.getCartItems();%0A            out.println(%22%3Ctable border='1px'%3E%22);%0A             %0A            for(String key: items.keySet())%7B%0A                out.println(%22%3Ctr%3E%3Ctd%3E%22+key+%22 - %3C/td%3E%3Ctd%3E%22+%22$%22+items.get(key)+%22%3C/td%3E%22%0A                %09%09+ %22%3Ctd%3E%3Cform action='deleteItem'%3E%3Cinput type='hidden' name='key' value='%22+key+%22'%3E%3Cinput type='submit' value='delete' name='delete'%3E%3C/form%3E%3C/td%3E%3C/tr%3E%22);%0A            %7D%0A            out.println(%22%3Ctable%3E%22);%0A            out.println(%22%3C/body%3E%22);%0A            out.println(%22%3C/html%3E%22);%0A             %0A        %7D%0A    %7D%0A%7D%0A

Create deleteItem.java