Clothing.java 563 B

1234567891011121314151617181920212223242526272829
  1. package J20250724.demo01;
  2. /**
  3. * @author WanJl
  4. * @version 1.0
  5. * @title Clothing
  6. * @description
  7. * @create 2025/7/24
  8. */
  9. public class Clothing extends Product{
  10. private Integer size;
  11. public Integer getSize() {
  12. return size;
  13. }
  14. public void setSize(Integer size) {
  15. this.size = size;
  16. }
  17. @Override
  18. public double getDiscountPrice() throws InvalidPriceException{
  19. Double price = this.getPrice();
  20. if (price<=0){
  21. throw new InvalidPriceException("价格异常");
  22. }
  23. return 0;
  24. }
  25. }