java-ArrayList实现一个电商管理系统的商品库存管理模块
实现一个电商管理系统的商品库存管理模块
商品(Goods)包含如下属性信息:
- 编号(int no)
- 商品名(String name
- 零售价(double price)
- 折扣价(double disprice)
- 库存量(int count)+
- 类别(String category):零食,饮料,酒水,服装,手机…
- 状态(String status):正常,库存不足,下架包含如下构造器:
- Goods():
- Goods(int no):
- Goods(int no,String name,double price,int count,String category)
- 根据编号构建商品对象
- 要求实现如下功能:
-
- 添加商品信息(无需指定折扣价)
-
- 根据商品编号查询商品信息
-
- 查询零售价超过100元的商品信息
-
- 对零售价超过100元的商品打8.5折并设置为折扣价
-
- 查询所有商品信息
-
- 将库存量低于5的商品的状态设置为“库存不足”
-
- 将库存量低于5的商品库存设置为100,并将状态标记为“正常”
-
- 将“酒水”类商品全部标记为“下架”
-
- 查询零食类商品的所有信息
-
- 显示所有状态为“正常”的商品信息
Goods.java
package com.lession.example.practice01;
public class Goods {
private int no; // 编号
private String name; // 商品名
private double price; // 零售价
private double disPrice; // 折扣价
private int count; // 库存量
private String category; // 类别
private String status; // 状态
public Goods() {
}
public Goods(int no) {
this.no = no;
}
public Goods(int no, String name, double price, int count, String category, String status) {
this.no = no;
this.name = name;
this.price = price;
this.count = count;
this.category = category;
this.status = status;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getName() {
return name;
}
public void