Week 8 Java Project [Merchandise.java]

 /**

 *
 * @author AMARE
 */
public class Merchandise 
{
    private long id;
    private String category = new String();
    private String description = new String();
    private double price;
    private boolean inStock;
        
        /**
         * No argument constructor method for merchandise
         */
        public Merchandise()
        {
                
        }
        /**
         * The parameterized constructor method accepts arguments
         * @param id
         * @param category
         * @param description
         * @param price
         * @param inStock 
         */
        public Merchandise(long idString categoryString descriptiondouble priceboolean inStock)
        {
        if (category.equalsIgnoreCase("T-Shirt")) 
        {
                this.category = category;
                } else if(category.equalsIgnoreCase("Sweatshirt"))
                {
                        this.category = category;
                } else if(category.equalsIgnoreCase("Stuffed Animal"))
                {
                        this.category = category;
                }
                else if(category.equalsIgnoreCase("Jeans"))
                {
                        this.category = category;
                }
                else
                {
                    System.out.println("Invalid Merchandise category. Please, talk to a member of staff.");
                        this.category = "UNKNOWN";
                }
                
                this.description = description;
                this.id = id;
        this.price = price;
        this.inStock = inStock;
        }
        
        /**
         * The parameterized constructor method 
         * @param p 
         */
        public void setPrice(double p)
        {
            this.price = p;
        }
                
        /**
         * The parameterized constructor method 
         * @param newStatus 
         */
        public void setInstock(boolean newStatus)
        {
                this.inStock = newStatus;
        }
        
        /**
         * The no arguments constructors method returns ID
         * @return 
         */
        public long getId()
        {
                return this.id;
        }
        
        /**
         * The no arguments constructors method returns category
         * @return 
         */
        public String getCategory()
        {
                return this.category;
        }
        
        /**
         * The no arguments constructors method returns description
         * @return 
         */
        public String getDescription()
        {
                return this.description;
        }
        
        /**
         * The no arguments constructors method returns this.price
         * @return 
         */
        public double getPrice()
        {
                return this.price;
        }
        
        /**
         * The no arguments constructors method returns this.inStock
         * @return 
         */
        public boolean getInstock()
        {
                return this.inStock;
        }

        /**
         * The no arguments constructors method returns Strings
         * @return 
         */
        
        public String toString()
        {
        return "Merchandise [id = " + getId() + ", category = " + getCategory() + ", description = " + getDescription() + ", \n" 
                +" price = $" + getPrice() + ", inStock = " + getInstock() + "]";
        }
        
}

Comments

Popular posts from this blog

Nаturаl Resource Conservаtion аnd Environmentаl Protection of the Nile River

Assignment 3: Apple versus Samsung

Week 8 Java Project [AmusementPark.java]