Class Product


  • public class Product
    extends java.lang.Object
    This class represents a Product object with various attributes, a constructor to initialize them and various methods.
    • Constructor Summary

      Constructors 
      Constructor Description
      Product​(java.lang.String productName, float productPrice, char productNutriScore, Vendor vendor)
      Constructs a new Product object with the given name, price, Nutri-Score, and vendor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getProductId()
      Returns the ID of the product.
      java.lang.String getProductName()
      Returns the name of the product.
      char getProductNutriScore()
      Returns the Nutri-Score of the product.
      float getProductPrice()
      Returns the price of the product.
      Vendor getVendor()
      Returns the vendor of the product.
      void setProductId​(int productId)
      Sets the ID of the product to the specified value.
      void setProductName​(java.lang.String productName)
      Sets the name of the product to the specified value.
      void setProductNutriScore​(char productNutriScore)
      Sets the Nutri-Score of the product to the specified value.
      void setProductPrice​(float productPrice)
      Sets the price of the product to the specified value.
      void setVendor​(Vendor vendor)
      Sets the vendor of the product to the specified value.
      java.lang.String toString()
      Returns a string representation of the Product instance.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Product

        public Product​(java.lang.String productName,
                       float productPrice,
                       char productNutriScore,
                       Vendor vendor)
        Constructs a new Product object with the given name, price, Nutri-Score, and vendor.
        Parameters:
        productName - the name of the product
        productPrice - the price of the product
        productNutriScore - the Nutri-Score of the product
        vendor - the vendor of the product
    • Method Detail

      • getProductId

        public int getProductId()
        Returns the ID of the product.
        Returns:
        the ID of the product
      • setProductId

        public void setProductId​(int productId)
        Sets the ID of the product to the specified value.
        Parameters:
        productId - the new ID of the product
      • getProductName

        public java.lang.String getProductName()
        Returns the name of the product.
        Returns:
        the name of the product
      • setProductName

        public void setProductName​(java.lang.String productName)
        Sets the name of the product to the specified value.
        Parameters:
        productName - the new name of the product
      • getProductPrice

        public float getProductPrice()
        Returns the price of the product.
        Returns:
        the price of the product
      • setProductPrice

        public void setProductPrice​(float productPrice)
        Sets the price of the product to the specified value.
        Parameters:
        productPrice - the new price of the product
      • getProductNutriScore

        public char getProductNutriScore()
        Returns the Nutri-Score of the product.
        Returns:
        the Nutri-Score of the product
      • setProductNutriScore

        public void setProductNutriScore​(char productNutriScore)
        Sets the Nutri-Score of the product to the specified value.
        Parameters:
        productNutriScore - the new Nutri-Score of the product
      • getVendor

        public Vendor getVendor()
        Returns the vendor of the product.
        Returns:
        the vendor of the product
      • setVendor

        public void setVendor​(Vendor vendor)
        Sets the vendor of the product to the specified value.
        Parameters:
        vendor - the new vendor of the product
      • toString

        public java.lang.String toString()
        Returns a string representation of the Product instance.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the Product instance