Stock.java
上传用户:hensond
上传日期:2021-12-27
资源大小:817k
文件大小:1k
- package com.company.section2;
- import java.util.Random;
- /**
- * @author cbf4Life cbf4life@126.com
- * I'm glad to share my knowledge with you all.
- * 存货
- */
- public class Stock extends AbstractColleague {
- public Stock(AbstractMediator _mediator){
- super(_mediator);
- }
- //刚开始有100台电脑
- private static int COMPUTER_NUMBER =100;
-
- //库存增加
- public void increase(int number){
- COMPUTER_NUMBER = COMPUTER_NUMBER + number;
- System.out.println("库存数量为:"+COMPUTER_NUMBER);
- }
-
- //库存降低
- public void decrease(int number){
- COMPUTER_NUMBER = COMPUTER_NUMBER - number;
- System.out.println("库存数量为:"+COMPUTER_NUMBER);
- }
-
- //获得库存数量
- public int getStockNumber(){
- return COMPUTER_NUMBER;
- }
-
- //存货压力大了,就要通知采购人员不要采购,销售人员要尽快销售
- public void clearStock(){
- System.out.println("清理存货数量为:"+COMPUTER_NUMBER);
- super.mediator.execute("stock.clear");
-
- }
- }