2023年12月9日发(作者:雪铁龙4s店全国一览表)
C++课程设计——停车场管理系统
停车场管理系统课程设计报告
1. 需求分析
2. 总体设计
3. 详细设计
4. 编码
5. 测试的步骤与内容
6. 总结
7. 参考文献
1. 需求分析
1.1 需求概述
设计一个停车场管理系统,使之能提供以下功能:
用户端:
⑴ 停车功能
⑵ 取车功能
管理员端:
⑴ 停车功能
⑵ 取车功能
⑶ 查询功能
⑷ 查询并修改功能
⑸ 显示停车场车辆功能
1.2 需求说明
(1) 车辆信息包括车牌号、颜色、车型、停车时间。
(2) 车辆信息用文件形式保存,并可以对其进行查看、查询、修改、删除等基本操作。
(3) 车辆信息要显示出车牌号、颜色、车型、停车的时间。
(4) 每个车辆信息是独立的、修改其中一个不会对其他造成影响。
(5) 对车辆信息可以通过车牌号、颜色、车型、停车时间结合来查询。
(6) 管理系统以菜单的形式展示给用户,更加便于使用。
2. 总体设计
功能划分
该系统按照功能模块划分,如图所示。
其中:
⑴ 用户通过用户端自主存取车或者通过管理员端接受存取车和查询等服务。
⑵ 查询车辆信息实现实时查询停车场所要查询车辆的信息(需要管理员权限)。
⑶ 显示车辆信息实现实时显示停车场所有车辆信息(需要管理员权限)
⑶ 编辑车辆信息实现对特定车辆的信息修改(需要管理员权限)
⑷ 统计车辆实现实时对停车场车辆总数的统计(需要管理员权限)。
⑸ 加载文件实现在重启管理端后加载所存车辆信息(需要管理员权限)。
1. 详细设计
3.1类设计
管理系统中包含了3个类
⑴ 车类:包含了车牌号、颜色、车型、停车时间。
class Car
{
public:
string licensePlate;
string color;
string model;
int time;
};
⑵ 管理员类:包括车辆的实例化,存车、查询、显示、修改、取车、统计、保存、加载功能函数。
class Manage
{
public:
Car a[100]; void add();
void inquire();
void show();
void modification();
void del();
void statistics();
void save();
void load();
};
⑶ 使用者类:包括用户名和密码,管理员的户名和密码,还有一个登陆验证的功能函数。
class User
{
public:
string ID;
string password;
string IDAdmin;
string passwordAdmin;
void longin();
};
3.2功能设计
存车: void add();
查询: void inquire();
显示: void show();
查询并修改: void modification();
取车: void del();
统计: void statistics();
保存: void save();
加载: void load();
登陆验证:void longin();
3.3菜单设计
4. 代码
#include
#include
#include
#include
int i;
class Car
{
public:
string licensePlate;
string color;
string model;
int time;
};
class Manage
{
public:
Car a[100];
void add();
void inquire();
void show();
void modification();
void del();
void statistics();
void save();
void load();
};
void Manage::add()
{
string licensePlate1;
string color1;
string model1;
int time1;
cout<<\"欢迎停车n\"< if(i==100) { cout<<\"对不起,停车场停车位已满!\"< } else { cout<<\"请输入车牌号:\"; cin>>licensePlate1; a[i].licensePlate = licensePlate1; cout<<\"请输入车辆颜色:\"; cin>>color1; a[i].color = color1; cout<<\"请输入车型:\"; cin>>model1; a[i].model = model1; cout<<\"请输入停车时间:\"; cin>>time1; a[i].time = time1; i++; cout<<\"请将车停到停车场中空的车位!\"< } } void Manage::inquire() { int t; int k; string val; cout<<\"请选择查询方式\"< cout<<\"1.通过车牌号查询\"< cout<<\"2.通过车颜色查询\"< cout<<\"3.通过车型查询\"< cout<<\"4.通过停车时间查询\"< cin>>t; switch(t) { case 1: cout<<\"请输入车牌号码:\"; cin>>val; for(int j = 0;j { if(e(a[j].licensePlate)==0) { cout<<\"您所查询的车辆的车牌号为:\"< cout<<\"您所查询的车辆的颜色为:\"< cout<<\"您所查询的车辆的车型为:\"< cout<<\"您所查询的车辆的停车时间为:\"< } } system(\"pause\"); break; case 2: cout<<\"请输入车的颜色:\"; cin>>val; for(int j = 0;j { if(e(a[j].color)==0) { cout<<\"您所查询的车辆的车牌号为:\"< cout<<\"您所查询的车辆的颜色为:\"< cout<<\"您所查询的车辆的车型为:\"< cout<<\"您所查询的车辆的停车时间为:\"< } } system(\"pause\"); break; case 3: cout<<\"请输入车的型号:\"; cin>>val; for(int j = 0;j { if(e(a[j].model)==0) { cout<<\"您所查询的车辆的车牌号为:\"< cout<<\"您所查询的车辆的颜色为:\"< cout<<\"您所查询的车辆的车型为:\"< cout<<\"您所查询的车辆的停车时间为:\"< } } system(\"pause\"); break; case 4: cout<<\"请输入停车时间:\"; cin>>k; for(int j = 0;j if(k==a[j].time) { cout<<\"您所查询的车辆的车牌号为:\"< cout<<\"您所查询的车辆的颜色为:\"< cout<<\"您所查询的车辆的车型为:\"< cout<<\"您所查询的车辆的停车时间为:\"< } } system(\"pause\"); break; } } void Manage::modification() { string c; string licensePlate1; string color1; string model1; int time1; cout<<\"请输入您所查询的车牌号码:\"< cin>>c; for(int j = 0;j { if(e(a[j].licensePlate)==0) { cout< cout<<\"请输入修改后的车牌号:\"; cin>>licensePlate1; a[j].licensePlate = licensePlate1; cout<<\"请输入修改后的车辆颜色:\"; cin>>color1; a[j].color = color1; cout<<\"请输入修改后车型:\"; cin>>model1; a[j].model = model1; cout<<\"请输入修改后停车时间:\"; cin>>time1; a[j].time = time1; } break; } } void Manage::del() { int j; string c; cout<<\"欢迎出停车场!\"< cout<<\"请输入您想出停车场车辆的车牌号码:\"< cin>>c; for(j=0;j { if(e(a[j].licensePlate)==0) { cout<<\"您的停车时间为\"<
更多推荐
车辆,查询,停车场,信息,管理员,停车,实现,修改
发布评论