儿童商品仓库管理系统.docx
- 文档编号:3980752
- 上传时间:2022-11-26
- 格式:DOCX
- 页数:25
- 大小:371.62KB
儿童商品仓库管理系统.docx
《儿童商品仓库管理系统.docx》由会员分享,可在线阅读,更多相关《儿童商品仓库管理系统.docx(25页珍藏版)》请在冰豆网上搜索。
儿童商品仓库管理系统
儿童商品仓库管理系统
信息科学与技术学院
信息安全
(1)班
20112650
庄云圣
目录
第一章、题目………………………………………………………………………..3
第二章、设计说明………………………………………………………………..4
第三章、类图………………………………………………………………………..5
第四章、源程序…………………………………………………………………….6
第五章、调试过程记录…………………………………………………………20
第六章、系统运行过程功能展示和截图………………………………21
第七章、总结…………………………………………………………………………28
第一章题目
实现一个简单的儿童商品仓库管理系统。
系统的主要功能是登记仓库中各儿童用品的信息情况,对部分信息进行检查和处理,并将结果保存。
假设仓库有3中不同类型的商品:
食品、鞋子、玩具。
对于食品,要求检查是否过期,并作相应处理;对于鞋子,要求检查是否过季,如果是就要做出相应处理。
把每一类商品当作一个对象,定义一个类,共定义三个类;定义一个基类(儿童商品类),在此基础上派生出三个类;对于每类商品至少要有名称、编号、进价、库存、入库时间、数量等信息;对于每类商品至少包含的功能至少要有信息录入、信息显示等;每类商品的其他信息和功能由同学自己增加。
第二章设计说明
1、数据分析
题目要求总共有四个类,其中儿童商品作为基类派生出食品类、鞋类、玩具类。
而三种商品都具有的信息,如商品名称,商品单价,商品生产日期,商品库存数量等四项信息放在基类里进行派生。
而像食品类的保质期,鞋类的销售季节期则作为各自的数据成员在继承后另外补充。
2、结构分析
为清晰程序结构,总共在所创建的工程中写三个文件。
其中classandfunction.h列出了每个类所具有的数据成员和函数成员;
details.cpp写出了所有功能的实现部分;main_programme.cpp为主函数部分,包括了对象的生成和最基本的操作。
考虑到程序有三个需要操作的类,所以另外设置了一个manage的类,将其余三个类作为其数据成员放入其中。
在成员函数部分,根据功能需要对三个类的数据进行处理。
第三章类图
第四章源程序
//classandfunction.h
classchildrencommodity
{
public:
charname[20];
doublein_price;
intin_time;
intstocknumber;
childrencommodity(char*p,doublea,intb,intc);//带参数的构造函数
childrencommodity(){};//不带参数的构造函数
~childrencommodity();//析构函数
};
classfood:
publicchildrencommodity//公有继承
{
public:
intsafe_period;//保质期
intNofood;//编号
food(char*p,doublea,intb,intc,intd);//food类的构造函数
food(){};
~food();
};
classshoes:
publicchildrencommodity
{
public:
intseason_period;//销售季节限制
intNoshoes;
shoes(char*p,doublea,intb,intc,intd);
shoes(){};
~shoes();
};
classtoys:
publicchildrencommodity
{
public:
intNotoys;
toys(char*p,doublea,intb,intc);
toys(){};
~toys();
};
classmanage
{
public:
foodfood0[10];//类的组合
shoesshoes0[10];//数据成员为对象数组
toystoys0[10];
manage(){};
charfirst_face();//系统封面
voidin_storage();//录入功能封面
voidfood_in_storage();
voidshoes_in_storage();
voidtoys_in_storage();
voidcheck_first();//检查功能封面
voidcheck_safe();
voidcheck_season();
voidshow_first();//显示功能封面
voidfoodshow();
voidshoesshow();
voidtoysshow();
};
//details.cpp
#include
#include
#include
#include
#include
#include
#include"conio.h"
#include"classandfunction.h"
#defineMAX_BUF1024
usingnamespacestd;
childrencommodity:
:
childrencommodity
(char*p="childrencommodity",doublea=0,intb=20120528,intc=0)
{strcpy(name,p);in_price=a;in_time=b;stocknumber=c;}
childrencommodity:
:
~childrencommodity(){}
food:
:
food(char*p="food",doublea=0,intb=20120528,intc=0,intd=12):
childrencommodity(p,a,b,c)
{safe_period=b+d*100;}
food:
:
~food(){}
shoes:
:
shoes(char*p="shoes",doublea=0,intb=20120528,intc=0,intd=3):
childrencommodity(p,a,b,c)
{season_period=d;}
shoes:
:
~shoes(){}
toys:
:
toys(char*p="toys",doublea=0,intb=20120528,intc=0):
childrencommodity(p,a,b,c)
{}
toys:
:
~toys(){}
charmanage:
:
first_face()
{system("cls");
cout<<"儿童商品仓库管理系统"< cout<<"1、商品登记录入"< cout<<"2、商品信息检查"< cout<<"3、商品信息显示"< cout<<"4、退出系统"< returngetch(); } voidmanage: : in_storage() { system("cls"); chara; cout<<"商品登记录入"< cout<<"请选择商品属于哪一类。 。 。 。 。 。 "< cout<<"1、食品类"< cout<<"2、鞋子类"< cout<<"3、玩具类"< cout<<"4、返回"< cin>>a; switch(a) { case'1': food_in_storage();break; case'2': shoes_in_storage();break; case'3': toys_in_storage();break; case'4': return; default: break; } } voidmanage: : food_in_storage() { intn1; charfoodname[20]; doublefoodprice; intfoodnumber; intproducetime; intsafeperiod; inta; system("cls"); cout<<"----请输入要输入几类食品: "; cin>>n1; for(inti=0;i { cout<<"------------请输入商品信息-------------"< cout<<"商品编号: "; cin>>a; cout< cout<<"商品名称: "; cin>>foodname; cout< cout<<"商品价格: "; cin>>foodprice; cout< cout<<"商品生产日期: "; cin>>producetime; cout< cout<<"商品数量: "; cin>>foodnumber; cout< cout<<"商品保质期至: "; cin>>safeperiod; cout< strcpy(food0[i].name,foodname); food0[i].in_price=foodprice; food0[i].in_time=producetime; food0[i].stocknumber=foodnumber; food0[i].safe_period=safeperiod; food0[i].Nofood=a; ofstreamstorefile("food.txt",ios: : app); storefile< : left)< < < storefile.close(); cout<<"该商品已经入库......."< } system("pause"); } voidmanage: : shoes_in_storage() { inta; charshoesname[20]; intn2; doubleshoesprice; intproducetime; intshoesnumber; intseasonperiod; system("cls"); cout<<"请输入要输入几类鞋子: "; cin>>n2; for(inti=0;i { cout<<"------------请输入商品信息-------------"< cout<<"商品编号: "; cin>>a; cout< cout<<"商品名称: "; cin>>shoesname; cout< cout<<"商品价格: "; cin>>shoesprice; cout< cout<<"商品购入日期: "; cin>>producetime; cout< cout<<"商品数量: "; cin>>shoesnumber; cout< cout<<"到季时间至: "; cin>>seasonperiod; cout< strcpy(shoes0[i].name,shoesname); shoes0[i].in_price=shoesprice; shoes0[i].in_time=producetime; shoes0[i].stocknumber=shoesnumber; shoes0[i].season_period=seasonperiod; shoes0[i].Noshoes=a; ofstreamstorefile("shoes.txt",ios: : app); storefile< : left)< < < storefile.close(); cout<<"该商品已经入库......."< } system("pause"); } voidmanage: : toys_in_storage() { intn3,a; chartoysname[20]; doubletoysprice; inttoysnumber; intproducetime; system("cls"); cout<<"请输入要输入几类玩具: "; cin>>n3; for(inti=0;i { cout<<"------------请输入商品信息-------------"< cout<<"商品编号: ";cin>>a;cout< cout<<"商品名称: ";cin>>toysname;cout< cout<<"商品价格: ";cin>>toysprice;cout< cout<<"商品生产日期: ";cin>>producetime;cout< cout<<"商品数量: ";cin>>toysnumber;cout< strcpy(toys0[i].name,toysname); toys0[i].in_price=toysprice; toys0[i].in_time=producetime; toys0[i].stocknumber=toysnumber; toys0[i].Notoys=a; ofstreamstorefile("toys.txt",ios: : app); storefile< : left)< < < storefile.close(); cout<<"该商品已经入库......."< } system("pause"); } voidmanage: : check_first() { while (1) {system("cls"); cout<<"--------------请输入要检查什么项目--------------"< cout<<"1、检查食品保质期"< cout<<"2、检查鞋子是否过季"< cout<<"3、返回"< charselect=getch(); switch(select) { case'1': check_safe();break; case'2': check_season();break; case'3': return; default: break; } } } voidmanage: : check_safe() {intn; cout<<"------------请输入要检查食品的编号----------"< cout< inta; cout< cin>>a; cout<<"----------------请输入当前年月--------------"< intdate; cin>>date; n=a; food*p=newfood[n]; ifstreamcf("food.txt"); for(intk=0;k { cf>>p->Nofood>>p->name>>p->in_price>>p->in_time>>p->stocknumber>> p->safe_period; if(k! =n-1)p++; } if(date>p->safe_period) { cout<<"该食品已到保质期,请马上处理"< system("pause"); } elseif(date { cout<<"该食品未到达保质期"< system("pause");} } voidmanage: : check_season() {intn; cout<<"------------请输入要检查鞋类的编号----------"< inta; cout< cin>>a; cout< cout<<"----------------请输入当前年月--------------"< intdate; cin>>date; n=a; shoes*p=newshoes[n]; ifstreamcs("shoes.txt"); for(intk=0;k { cs>>p->Noshoes>>p->name>>p->in_price>>p->in_time>>p->stocknumber>> p->season_period; if(k! =n-1)p++; } if(date>p->season_period) {cout<<"该鞋子已过季,请马上处理"< system("pause"); } elseif(date {cout<<"该鞋类正季,请合理销售"< system("pause"); } elsecout<<"时间错误! "; system("pause"); } voidmanage: : show_first() { system("cls"); cout<<"----------请选择要显示的商品信息-----------"< cout<<"1、食品类"< cout<<"2、鞋类"< cout<<"3、玩具类"< cout<<"4、返回"< charchoose=getch(); switch(choose) { case'1': foodshow();break; case'2': shoesshow();break; case'3': toysshow();break; case'4': return; default: break; } } voidmanage: : foodshow() { FILE*fp=NULL; intch=0; charbuf[MAX_BUF]={0}; fp=fopen("food.txt","r"); if(fp==NULL) { printf("Cann'tnotopenthefile! \n"); exit (1); } else { cout<<"编号名称单价生产日期库存数量保质期至"< while(! feof(fp)) { fgets(buf,MAX_BUF,fp); printf("%s",buf); } printf("\n"); fclose(fp); } system("pause"); } voidmanage: : shoesshow() { FILE*fp=NULL; intch=0; charbuf[MAX_BUF]={0}; fp=fopen("shoes.txt","r"); if(fp==NULL) { printf("Cann'tnotopenthefile! \n"); exit (1); } else { cout<<"编号名称单价生产日期库存数量季节时限"< while(! feof(fp)) { fgets(buf,MAX_BUF,fp); printf("%s",buf); } printf("\n"); fclose(fp); } system("pause"); } voidmanage: : toysshow() { FILE*fp=NULL; intch=0; charbuf[MAX_BUF]={0}; fp=fopen("toys.txt","r"); if(fp==NULL) { printf("Cann'tnotopenthefile! \n"); exit (1); } else { cout<<"编号名称单价生产日期库存数量"< while(! feof(fp)) {
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 儿童 商品 仓库 管理 系统
![提示](https://static.bdocx.com/images/bang_tan.gif)