Product.java 717B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Created by leon on 1/10/18.
  3. */
  4. public class Product {
  5. private float price;
  6. private int quantity;
  7. final private String id;
  8. public Product(float price, int quantity, String id) {
  9. this.price = price;
  10. this.quantity = quantity;
  11. this.id = id;
  12. }
  13. public void setPrice(float newPrice) {
  14. this.price = newPrice;
  15. }
  16. public float getPrice() {
  17. return price;
  18. }
  19. public void addUnits(int numUnits) {
  20. quantity += numUnits;
  21. }
  22. public void removeUnits(int numUnits) {
  23. quantity -= numUnits;
  24. }
  25. public int getOnHandQuantity() {
  26. return quantity;
  27. }
  28. public String getID() {
  29. return id;
  30. }
  31. }