Stock.java
上传用户:hensond
上传日期:2021-12-27
资源大小:817k
文件大小:1k
源码类别:

软件工程

开发平台:

Java

  1. package com.company.section2;
  2. import java.util.Random;
  3. /**
  4.  * @author cbf4Life cbf4life@126.com
  5.  * I'm glad to share my knowledge with you all.
  6.  * 存货
  7.  */
  8. public class Stock extends AbstractColleague {
  9. public Stock(AbstractMediator _mediator){
  10. super(_mediator);
  11. }
  12. //刚开始有100台电脑
  13. private static int COMPUTER_NUMBER =100;  
  14. //库存增加
  15. public void increase(int number){
  16. COMPUTER_NUMBER = COMPUTER_NUMBER + number;
  17. System.out.println("库存数量为:"+COMPUTER_NUMBER);
  18. }
  19. //库存降低
  20. public void decrease(int number){
  21. COMPUTER_NUMBER = COMPUTER_NUMBER - number;
  22. System.out.println("库存数量为:"+COMPUTER_NUMBER);
  23. }
  24. //获得库存数量
  25. public int getStockNumber(){
  26. return COMPUTER_NUMBER;
  27. }
  28. //存货压力大了,就要通知采购人员不要采购,销售人员要尽快销售
  29. public void clearStock(){
  30. System.out.println("清理存货数量为:"+COMPUTER_NUMBER);
  31. super.mediator.execute("stock.clear");
  32. }
  33. }