Sale.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 Sale extends AbstractColleague {
- public Sale(AbstractMediator _mediator){
- super(_mediator);
- }
-
- //销售IBM型号的电脑
- public void sellIBMComputer(int number){
- super.mediator.execute("sale.sell", number);
- System.out.println("销售IBM电脑"+number+"台");
- }
-
- //反馈销售情况,0——100之间变化,0代表根本就没人卖,100代表非常畅销,出1一个卖一个
- public int getSaleStatus(){
- Random rand = new Random(System.currentTimeMillis());
- int saleStatus = rand.nextInt(100);
- System.out.println("IBM电脑的销售情况为:"+saleStatus);
- return saleStatus;
- }
-
- //折价处理
- public void offSale(){
- super.mediator.execute("sale.offsell");
- }
- }