停车场管理系统设计--《数据结构课程设计》报告
时间:2025-05-15
时间:2025-05-15
停车场管理系统设计--《数据结构课程设计》报告
《数据结构课程设计》报告
1、需求分析
在停车场管理中,往往涉及到计费的问题,记录每个车辆的【进出时间】,以及根据特定的【收费标准】来计算费用,是停车场管理的关键所在。在此基础之上,引导用户【设置收费标准】以及【设置停车场、便道大小】是广泛适用于任何停车场的必要前提。(已实现)用户的不同,导致所给权限不同。管理者只需记录进出车辆即可,而负责人需要根据需要调整收费标准,给这两种人不同的权限与界面也一定程度上让系统更加广泛的使用与任何停车场。(未实现)
为保护数据安全,也可增加操作日志。(未实现)
2、概要设计
2.1栈的抽象数据类型定义(模板类-链式)
template <class Type>
class Element
{
public:
Element();//构造函数
Element(Type Goal);//重载构造函数,定义栈的大小
public:
Type Value;//保存数值
Element *Top;//栈顶指针
Element *Prior;//由栈顶指向下一个
};
template <class Type>
class Stack
{
public:
Stack(int Max_Size_Value = 300000);//构造函数,默认栈的大小为300000
inline bool push(Type Goal);//入栈
inline Type top();//取出栈顶元素
inline bool pop();//出栈
inline int size();//栈中元素个数
inline bool resize(int Num);//重置栈的空间
停车场管理系统设计--《数据结构课程设计》报告
inline bool clear();//清空栈
inline bool empty();//判断是否为空,为空返回true
private:
Element<Type> *Head;//头指针,保护数据不被修改
int Now_Size;//当前栈中元素个数
int Max_Size;//栈的最大存储空间
};
2.2队列的抽象数据类型定义(模板类-链式)
template <class Type>
class Element
{
public:
Element();//构造函数
Element(Type Goal);//重载构造函数,定义栈的大小
public:
Type Value;//保存数值
Element *Front;//指向队头元素
Element *Tail;//指向队尾元素
Element *Prior;//每个元素的前驱指针
Element *Next;//每个元素的后继指针
};
template <class Type>
class Queue
{
public:
Queue(int Max_Size_Value=300000);//构造函数,默认队列大小为300000 inline bool push(Type Goal);//入队
inline bool pop();//出队
inline bool connect();//循环队列连接,头尾相连
inline bool disconnect();//将头尾断开,循环队列变为单队列
inline Type front();//取出队头元素
inline Type back();//取出队尾元素
inline bool empty();//判断是否为空,为空返回true
inline int size();//队列中元素个数
private:
Element<Type> *Head;//头指针,保护数据不被修改
int Now_Size;//当前队列中元素个数
int Max_Size;//队列的最大存储空间
bool JudgeConnect;//循环队列判断标记,为循环队列时,值为true
};
停车场管理系统设计--《数据结构课程设计》报告
2.3主要功能调用(Main函数)
int main()
{
Initialization();//初始化,加载外部数据
Print_Help();//在屏幕上打印“帮助文件”
while (true)
{
string Command;
cout <<"请输入命令:";
cin >> Command;//命令行
if (Command =="Help") Print_Help();
else if (Command =="Now") Get_NowTime();
else if (Command =="Getinfo") Get_Infomation();
else if (Command =="I" || Command =="i") InPutStorage();
else if (Command =="O" || Command =="o") OutPutStorage();
else if (Command =="SetMoney") Set_Money_Index();
else if (Command =="SetTime") Set_Time_Index();
else if (Command =="SetCarStorage") Set_Storage_Index();
else if (Command =="SetCarRoad") Set_Road_Index();
else if (Command =="Save") Save_Infomation();
else if (Command =="End")
{
Exit();
break;
}
else
cout <<"命令无法识别,请重新输入。"<< endl;
}
return 0;
}
PS:具体帮助文档内容,见附录图1 。
2.4所需数组与函数列表(定义)
int Money_Index[3];//收费标准档次
int Time_Index[2];//时间分段
int Storage_Index;//停车场最大容量
int Road_Index;//便道最大容量
bool OutPutToTxt = false;//输出到文件标记,当值为true时,将不在控制台中输出内容。Stack <CarInfo> CarStorage(Storage_Index);//停车场内车辆数据
Stack <CarInfo> CarRoad(Road_Index);//便道内车辆数据
停车场管理系统设计--《数据结构课程设计》报告
void Initialization();//初始化
void Print_Help();//打印帮助文档
void Get_NowTime();//获取当前系统时间
void Get_Infomation();//获取所有信息
void Get_StorageInfomation();//获取停车场信息
void Get_RoadInfomation();//获取便道信息
void InPutStorage();//进入停车场
void OutPutStorage();//离开停车场
void InPutRoad();//进入便道
void OutPutRoad(string Goal);//离开便道
time_t Set_NowTime();//设置当前时间
CarInfo UpData_Now_Money(CarInfo &Goal);//更新当前费用CarInfo UpData_StorageNum(CarInfo &Goal);//更新停车场序号CarInfo UpData_RoadNum(CarInfo &Goal);//更新便道序号
void UpData_Index();//更新收费标准
上一篇:薛斯通道及实例详解
下一篇:贵州茶叶产区和主要产茶县