Java help

Discussion in 'Meet and Greet' started by javaholic, Feb 5, 2012.

  1. javaholic

    javaholic New Member

    Joined:
    Feb 5, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have a project on shopping cart where I have used jdk tomcat jsp java beans. My program is not compiling.

    ShoppingCartItem is a javabean where I use products. ShoppingCartItem is not getting comipled.
    Code:
    package cart.library;
    public class ShoppingCartItem
    {
        private final products products1;
        private int quantity;
        public ShoppingCartItem(products products1)
        {
            super();
            this.products1=products1;
            this.quantity=1;
        }
        public products getProducts()
        {
            return products1;
        }
        public int getQuantity()
        {
            return quantity;
        }
        public void setQuantity(int quantity)
        {
            this.quantity = quantity;
        }
        public boolean equals(Object obj)
        {
            return obj instanceof ShoppingCartItem && equals((ShoppingCartItem)obj);
        }
        public boolean equals(ShoppingCartItem that)
        {
            return this.products1 == that.products1;
        }
    }
    
    products is another javabean an instance of which is being used in the above ShoppingCartItem bean program. Products is getting compiled but ShoppingcartItem shows an error that "cannot resolve symbol products"
    products.java
    Code:
    package cart.library;
    public class products
    {
        private String title;
        private double price;
        private int pid;
        private int qty;
        private int dis;
        public products(int pid, String title, double price, int qty, int dis)
        {
            super();
            this.pid=pid;
            this.title=title;
            this.price=price;
            this.qty=qty;
            this.dis=dis;
        }
        public int getPid()
        {
            return this.pid;
        }
        public String getTitle()
        {
            return this.title;
        }
        public double getPrice()
        {
            return this.price;
        }
        public int getQty()
        {
            return this.qty;
        }
        public int getDis()
        {
            return this.dis;
        }
    }
    
    I need help for this project as soon as possible please because I have a deadline to meet for my final year project. Thanks in advance for the help.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice