C++课程设计报告商品管理系统.docx
- 文档编号:595520
- 上传时间:2023-04-29
- 格式:DOCX
- 页数:66
- 大小:86.53KB
C++课程设计报告商品管理系统.docx
《C++课程设计报告商品管理系统.docx》由会员分享,可在线阅读,更多相关《C++课程设计报告商品管理系统.docx(66页珍藏版)》请在冰点文库上搜索。
C++课程设计报告商品管理系统
课程设计报告
设计题目:
商品管理系统
学生姓名:
专业:
计算机科学与技术
班级:
学号:
指导老师:
完成日期:
2010年6月
(1)需求与规格说明
某商场有如下几种商品:
衬衣、鞋子、帽子、裤子、冰箱、电视、立柜、壁橱、沙发。
每一种货物都有详细的说明信息。
衬衣:
布料、尺寸、单价、产地、库存量、所属货柜;
鞋子:
皮料、尺寸、单价、产地、库存量、所属货柜;
帽子:
布料、样式(平顶或尖顶)、尺寸、单价、产地、库存量、所属货柜;
裤子:
布料、尺寸、单价、产地、库存量、所属货柜;
冰箱:
制冷类型、样式(两门或三门)、颜色、重量、尺寸、单价、产地、库存量、所属货柜;
电视:
样式(彩色或黑白)、颜色、重量、尺寸、单价、产地、库存量、所属货柜;
立柜:
木料、颜色、尺寸、单价、产地、库存量、所属货柜;
壁橱:
木料、颜色、尺寸、单价、产地、库存量、所属货柜;
沙发:
木料、皮料、颜色、尺寸、单价、产地、库存量、所属货柜;
对这些商品的操作有:
新商品的录入、商品的进库、商品的出库、商品的调价、所属货柜的管理、库存的统计、总价格的计算、产地的统计。
要求自行设计数据结构,用类结构将上述的货品表示出来。
在上一步基础上,将上述的商品管理计算机化,完成操作要求的功能。
(2)设计
根据上述要求,设计一个商品基类Goods,从中派生出衬衣类Clothes、帽子类Cap、冰箱类Refrigerator、电视类TV、立柜类Closet、沙发类Sofa。
因为鞋子类和裤子类与衬衣类、壁橱类与立柜类属性、行为完全相同,所以从衬衣类中派生出鞋子类Shoes、裤子类Pants,从立柜类中派生出壁橱类WAC。
在派生类中实现完整的操作方法。
系统类图
Goods
stringname
stringproducing_area
doublesize
doubleprice
intsum
intcounter
voidgoods_getout()
voidgoods_getin()
voidgoods_shows()
voidgoods_in()
voidgoods_out()
voidprice_change()
voidcounter_change()
↗↖
Clothes
stringmaterial
intclo_get(Clothesa[])
intclo_show(Clothesa[])
intclo_pa(Clothesa[])
intclo_operate(Clothesa[])
Cap
stringmaterial
stringstyle
intcap_get(Capa[])
intcap_show(Capa[])
intcap_pa(Capa[])
intcap_operate(Capa[])
↗↖
Shoes
Pants
↑↑
Refrigerator
stringrefrigeration_form
stringstyle
stringcolor
intref_get(Refrigeratora[])
intref_show(Refrigeratora[])
intref_pa(Refrigeratora[])
intref_operate(Refrigeratora[])
TV
stringstyle
stringcolor
doubleweight
inttv_get(TVa[])
inttv_show(TVa[])
inttv_pa(TVa[])
inttv_operate(TVa[])
↑↑
Closet
stringtimber
stringcolor
intcls_get(Closeta[])
intcls_show(Closeta[])
intcls_pa(Closeta[])
intcls_operate(Closeta[])
Sofa
stringtimber
stringcladding
stringcolor
intsofa_get(Sofaa[])
intsofa_show(Sofaa[])
intsofa_pa(Sofaa[])
intsofa_operater(Sofaa[])
↑
WAC
属性和方法定义
类名
成员类别
类型
成员名
描述
Goods
Goods
属性
属性
string
string
double
double
int
int
name
producing_area
size
price
sum
counter
商品名称
商品产地
商品尺寸
商品价格
商品总价
商品所属货柜
方法
void
void
void
void
void
void
void
goods_getout()
goods_getin()
goods_shows()
goods_in()
goods_out()
price_change()
counter_change()
提示输入商品信息
商品信息输入
商品信息输出
商品进库
商品出库
商品调价
商品货柜管理
Clothes
属性
string
material
商品布料
方法
int
int
int
int
clo_get(Clothesa[])
clo_show(Clothesa[])
clo_pa(Clothesa[])
clo_operate(Clothesa[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
Shoes
Pants
Cap
属性
string
string
material
style
布料
样式
方法
int
int
int
int
cap_get(Capa[])
cap_show(Capa[])
cap_pa(Capa[])
cap_operate(Capa[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
Refrigerator
属性
string
string
string
double
refrigeration_form
style
color
weight
制冷类型
样式
颜色
重量
方法
int
int
int
int
ref_get(Refrigeratora[])
ref_show(Refrigeratora[])
ref_pa(Refrigeratora[])
ref_operate(Refrigeratora[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
TV
属性
string
string
double
sytle
color
weight
样式
颜色
重量
方法
int
int
int
int
tv_get(TVa[])
tv_show(TVa[])
tv_pa(TVa[])
tv_operater(TVa[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
Closet
Closet
属性
string
string
timber
color
木料
颜色
方法
方法
int
int
int
int
cls_get(Closeta[])
cls_show(Closeta[])
cls_pa(Closeta[])
cls_operate(Closeta[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
WAC
Sofa
属性
string
string
string
timber
cladding
color
木料
皮料
颜色
方法
int
int
int
int
sofa_get(Sofaa[])
sofa_show(Sofaa[])
sofa_pa(Sofaa[])
sofa_operate(Sofaa[])
录入该类新商品
该类商品查询
该类商品产地查询
对该类商品的操作
(3)用户手册另见“泡泡商品管理系统用户手册”
(4)调试及测试:
现以衬衣类为例:
测试商品的录入、商品进库、查询商品信息、商品产地统计。
(因商品出库、商品调价、商品货柜管理与商品进库相似,所以仅演示一项)
现假设在衬衣类中已有四种商品分别为:
现运行如下:
(5)源程序:
#include
#include
#include
usingnamespacestd;
inti=2;//i用于界面转换
classGoods{
protected:
stringname,producing_area;
doublesize,price;
intsum,counter;
public:
voidgoods_getout();
voidgoods_getin();
voidgoods_shows();//输出商品信息
voidgoods_in();//商品进库
voidgoods_out();//商品出库
voidprice_change();//价格调整
voidcounter_change();
};
voidGoods:
:
goods_getout(){
cout<<"尺寸"<<"\t"
<<"单价"<<"\t"
<<"产地"<<"\t"
<<"库存量"<<"\t"
<<"所属货柜"<<"\t";
}
voidGoods:
:
goods_getin(){
cin>>size>>price>>producing_area>>sum>>counter;
}
voidGoods:
:
goods_shows(){
cout< < < < < } voidGoods: : goods_in(){ intb; charc; cout<<"现有库存: "< <<"请输入商品的新进库数: "; cin>>b; if(b>=0){ cout<<"确认商品新进库数为: "< (Y/N)"; cin>>c; if(c=='y'||c=='Y'){ sum=sum+b; cout<<"该商品的新库存为: "< } else{ if(c=='n'||c=='N') cout<<"该商品库存未变,仍为: "< } } else{ cout<<"输入错误"< } } voidGoods: : goods_out(){ intb; charc; cout<<"现有库存: "< <<"请输入商品的出库数: "; cin>>b; if(b>0){ if(b<=sum){ cout<<"确认商品出库数: "< (Y/N)"; cin>>c; if(c=='y'||c=='Y'){ sum=sum-b; cout<<"该商品的新库存为: "< } else{ if(c=='n'||c=='N') cout<<"该商品库存未变,仍为: "< } } else{ cout<<"该商品库存不足! "< } } else{ cout<<"输入错误! "< } } voidGoods: : price_change(){ charc; doubleb; cout<<"商品的价格为: "< <<"请输入商品的新价格: "; cin>>b; if(b>0){ cout<<"确认商品的新价格为: "< (Y/N)"; cin>>c; if(c=='y'||c=='Y'){ price=b; cout<<"该商品的新价格为: "< } else{ if(c=='n'||c=='N') cout<<"该商品价格未变,仍为: "< } } else{ cout<<"商品价格输入错误! "< } } voidGoods: : counter_change(){ intb; charc; cout<<"商品的货柜为: "< <<"请输入商品的新货柜: "; cin>>b; cout<<"确认商品的新货柜为: "< (Y/N)"; cin>>c; if(c=='y'||c=='Y'){ counter=b; cout<<"该商品的新货柜为: "< } else{ if(c=='n'||c=='N') cout<<"该商品货柜未变,仍为: "< } } classClothes: publicGoods{//衬衣类 protected: stringmaterial; public: intclo_get(Clothesa[]);//商品录入 intclo_show(Clothesa[]);//商品查询 intclo_pa(Clothesa[]);//产地统计 intclo_operate(Clothesa[]);//方法实现 }; intClothes: : clo_get(Clothesa[]){ intk,j; while(i==1){ for(j=1;a[j].name! ="";j++){} cout<<"名称"<<"\t" <<"材料"<<"\t"; a[j].goods_getout(); cout< cin>>a[j].name>>a[j].material; a[j].goods_getin(); for(k=0;k if(a[k].name! =a[j].name&&k==j-1){ if(a[j].size<=0||a[j].price<0||a[j].sum<0){ cout<<"商品信息输入错误! "< a[j].name=""; a[j].producing_area=""; break; } cout< "< cout<<"名称"<<"\t" <<"材料"<<"\t"; a[j].goods_getout(); cout< < < a[j].goods_shows(); cout< break; } if(a[k].name==a[j].name&&k cout<<"该商品已存在! "< a[j].name=""; a[j].producing_area=""; break; } } cout< <<"返回上一级,请按0."< cin>>i; } returni; } intClothes: : clo_show(Clothesa[]){ intk; stringn; doublez; while(i==1){ if(a[1].name==""){ cout<<"系统内暂无商品信息! "< } else{ cout<<"请输入要查询的商品名称、尺寸: "< cin>>n>>z; for(k=1;a[k].name! ="";k++){ if(a[k].name==n&&a[k].size==z){ cout<<"名称"<<"\t" <<"材料"<<"\t"; a[k].goods_getout();
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 课程设计 报告 商品 管理 系统