Class Product
- java.lang.Object
-
- Product
-
public class Product extends java.lang.ObjectThis class represents a Product object with various attributes, a constructor to initialize them and various methods.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetProductId()Returns the ID of the product.java.lang.StringgetProductName()Returns the name of the product.chargetProductNutriScore()Returns the Nutri-Score of the product.floatgetProductPrice()Returns the price of the product.VendorgetVendor()Returns the vendor of the product.voidsetProductId(int productId)Sets the ID of the product to the specified value.voidsetProductName(java.lang.String productName)Sets the name of the product to the specified value.voidsetProductNutriScore(char productNutriScore)Sets the Nutri-Score of the product to the specified value.voidsetProductPrice(float productPrice)Sets the price of the product to the specified value.voidsetVendor(Vendor vendor)Sets the vendor of the product to the specified value.java.lang.StringtoString()Returns a string representation of the Product instance.
-
-
-
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 productproductPrice- the price of the productproductNutriScore- the Nutri-Score of the productvendor- 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:
toStringin classjava.lang.Object- Returns:
- a string representation of the Product instance
-
-