Product.java 679B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Created by leon on 1/10/18.
  3. */
  4. public abstract class Product {
  5. private double price;
  6. private String id;
  7. private int quantity;
  8. public Product(double price, String id, int quantity){
  9. this.price = price;
  10. this.id = id;
  11. this.quantity = quantity;
  12. }
  13. public void setPrice(double num){
  14. price = num;
  15. }
  16. public double getPrice(){
  17. return price;
  18. }
  19. public void setId(String code){
  20. id = code;
  21. }
  22. public String getId(){
  23. return id;
  24. }
  25. public void setQuantity(int num){
  26. quantity = num;
  27. }
  28. public int getQuantity(){
  29. return quantity;
  30. }
  31. }