package com.company;
import java.util.Scanner;
/*
* 商品管理员* */
public class ArticleManage {
// 创建一个商品集合(仓库) 实例
ArticleSetarticleSet =new ArticleSet();
// 对新建的仓库进行初始化
public void initial () {
Article xiaomi11 =new Article();
xiaomi11.setArticle("小米11", 50, 2999,1);
Article xiaomi11Pro =new Article();
xiaomi11Pro.setArticle("小米11专业版",30, 3999, 2);
Article xiaomiULtra =new Article();
xiaomiULtra.setArticle("小米增强版",66,499,3);
//把商品放到仓库中
articleSet.articles[0] = xiaomi11;
articleSet.articles[1] = xiaomi11Pro;
articleSet.articles[2] = xiaomiULtra;
}
//起始菜单
public void startMenu(){
boolean flag =true;
do {
System.out.println("**********************");
System.out.println("1 查看商品信息");
System.out.println("2 新增商品信息");
System.out.println("3 删除商品信息");
System.out.println("4 卖出商品");
System.out.println("5 商品销售排行榜");
System.out.println("6 退出系统");
System.out.println("***************************");
System.out.println("请输入你要执行的操作");
Scanner scanner =new Scanner(System.in);
int gongnenBianhao = scanner.nextInt();
switch (gongnenBianhao) {
case 1:
System.out.println("查看商品信息");
chakan(); //调用查看商品信息
break;
case 2:
System.out.println("新增商品信息");
add(); //新增商品
break;
case 3:
System.out.println("删除商品信息");
break;
case 4:
System.out.println("卖出商品");
break;
case 5:
System.out.println("商品销售排行榜");
break;
case 6:
System.out.println("退出系统");
flag =false;
break;
default:
System.out.println("请输入你的功能编号");
break;
}
}while (flag);
}
// 查看商品信息
public void chakan(){
System.out.println("编号:\t 名称 \t 价格 \t 库存 \t 售出数量");
for (int i =0 ; i
if (articleSet.articles[i] !=null ) {
articleSet.articles[i].price(i);
}
}
}
//添加商品
public void add() {
System.out.println("请输入商品名称");
Scanner scanner =new Scanner(System.in);
String name = scanner.next();
System.out.println("请输入商品价格");
}
}