Product.java 900B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Created by leon on 1/10/18.
  3. */
  4. public class Product {
  5. private double price;
  6. private int quantity;
  7. private int id;
  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 this.price;
  19. }
  20. public void setQuantity(int newQuantity) {
  21. this.quantity = newQuantity;
  22. }
  23. public int getQuantity(){
  24. return quantity;
  25. }
  26. public void setId(int newId) {
  27. this.id = newId;
  28. }
  29. public int getId(){
  30. return this.id;
  31. }
  32. public String toString(){
  33. return Integer.toString(id) + "_ " + price + " _ " + quantity;
  34. }
  35. }