Product.java 852B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * Created by Mexi Liang 06/11/18
  3. */
  4. public class Product {
  5. private double price;
  6. private int id;
  7. private int quantity;
  8. public Product(){}
  9. public Product(int id,double price, int quantity){
  10. this.id =id;
  11. this.price = price;
  12. this.quantity = quantity;
  13. }
  14. public void setPrice(double newPrice){
  15. this.price = newPrice;
  16. }
  17. public double getPrice(){
  18. return price;
  19. }
  20. public void setId(int newId){
  21. this.id = newId;
  22. }
  23. public int getId(){
  24. return id;
  25. }
  26. public void setQuantity(Integer quantity){
  27. this.quantity = quantity;
  28. }
  29. public Integer getQuantity(){
  30. return quantity;
  31. }
  32. public String toString(){
  33. return Integer.toString(id) + " - "+ price + " - "+ quantity;
  34. }
  35. }