1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
-
-
- /**
- * Created by leon on 1/10/18.
- */
- public class ProductItem {
-
- private int productid;
- private int productquantity;
- private int productprice;
-
-
- //constructor : sets product id,quantity and description to 0 if no parameters given
- public ProductItem()
- {
- productid=0;
- productquantity=0;
- productprice=0;
- }
-
- //overload constructor : sets product id,quantity and description to whatever parameters given
- public ProductItem(int id, int quantity, int pr)
- {
- productid=id;
- productquantity=quantity;
- productprice = pr;
- }
-
- //sets a new id for productid
- public void setid (int newid)
- {productid=newid;}
-
- //sets a new id for productquantity
- public void setquantity (int newquantity)
- {productquantity=newquantity;}
-
- //sets a new id for productdesc
- public void setpr (int pr)
- {productprice=pr;}
-
- //get function that returns productid
- public int getid()
- {return productid;}
-
- //get function that returns productquantity
- public int getquantity()
- {return productquantity;}
-
- //get function that returns productdesc
- public int getpr()
- {return productprice;}
-
- //method to output ProductId
- public void outputid()
- {System.out.println("Product Id: " + productid);}
-
- //method to output ProductQuantity
- public void outputquantity()
- {System.out.println("Product Quantity: " + productquantity);}
-
- //method to output ProductDesc
- public void outputpr()
- {System.out.println("Price: " + productprice);}
-
- }
-
-
|