立体化停车场设计书.docx
《立体化停车场设计书.docx》由会员分享,可在线阅读,更多相关《立体化停车场设计书.docx(84页珍藏版)》请在冰豆网上搜索。
立体化停车场设计书
立体化停车场设计书
1.1课题任务
设停车场有地下和地面两层,统一管理。
地下停车场采用单入口和单出口。
地上停车场采用南北方向的双口,每个口都有一个入口和出口。
停车顺序先地面,后地下。
地面入口处各有一个单车道的等候通道,并允许等候的车辆因急事从等候通道直接开走。
具体的设计任务如下:
(1)采用栈、队列和有序表等数据结构。
(2)等候车辆的管理。
(3)地下、地上停车位的管理。
(4)停车计费功能。
1.2课题原理
针对本次课程设计的具体要求,我们设计了如下方案:
停车场内部选择栈作为基本数据结构,充分利用栈后进先出的数据结构特点,停车场外部的等候区域,针对其“先到先出”的工作特点,选择队列作为基本数据结构。
同时设计了计时计费功能,会员制度,针对不同型号,是否为会员的车辆进行分类收费。
2需求分析
2.1课题调研
为了完成本次课程设计任务,我们对校园周边的停车场运作状况进行了一系列的前期调研,包括停车场的管理系统的运行原理,收费标准等等,为本次课程设计任务的完成打下了良好的基础。
2.2功能需求
此次设计任务,要求停车场分为上下两层,上层为南北双向入口和出口,下层为单向入口出口,并要求我们设计等待区域。
对于收费标准,我们将不同型号的车分类收费,同时增加会员管理制度,对于多次在本停车场停车的会员给予优惠。
3方案设计
3.1总体功能设计
本次课程设计共分为四个主要功能:
(1)进入停车场
(2)离开停车场
(3)查看停车场现状
(4)计费功能
针对进入停车场的功能,我们设计了“先地上,后地下”,的停放顺序,当地上南北双向任一停车场停满后,再向该停车场进车,会显示“停车场已满”等提示信息,并将车辆停入有剩余车位的其他停车场。
当所有停车场均无停车位时,到来车辆将会进入等待区域,一旦有车辆离开停车场,最先到达等待的区域的车辆将会进入停车场。
针对离开停车场的功能,可选择任一停车场出车,并会根据停车时长,车辆类型,以及是否为会员等信息给出本次停车的费用。
针对查看停车场现状的功能,将显示车牌号,何处停车等相关信息。
此外,我们还设计了计费功能,利用windows系统自带函数获取时间,免去了人工手动输入时间的繁琐步骤,同时,针对不同车型,是否享受会员优惠等差异制定了不同的收费标准,使停车场的运行更为规范化,合理化。
3.2数据结构设计
本次课程设计主要使用了栈和队列两种数据结构,具体的设计方案和操作过程将在个人报告中给出,在此不再赘述。
3.3函数原型设计
intmain()
{
system("colorE1");
cout<cout<<~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~"<cout<<"<<<<<<<进入停车场管理系统>>>>>>>"<cout<<”~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^"<cout<cout<<"^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^"<cout<cout<cout<Carw;
intt=1;
s1.sInitStack();
s2.sInitStack();
temt1.sInitStack();
s3.InitStack(&s3);
temp1.InitStack(&temp1);
shortcut.InitQueue();
while(t)
{
cout<<"================================================"<cout<<"****◇1.进入停车场****"<cout<<"****◇2.离开停车场****"<cout<<"****◇3.查看停车场现状****"<cout<<"****◇0.退出****"<cout<<"================================================"<cout<cout<<"★★★★★★★★请输入功能选项:
";
cin>>t;
switch(t)
{
case1:
CarIn(&s3,&s1,&s2,&shortcut);break;
case2:
CarOut(&s3,&temp1,&s1,&s2,&temt1,&shortcut);break;
case3:
LookNow(&s3,&temp1,&s1,&s2,&temt1,&shortcut,&w);break;
case0:
break;
}
}
return0;
}
3.4用户界面设计
运行时为DOS界面,通过增加字符画,更换背景颜色等方法增加界面的美观度。
4方案实现
4.1开发环境与工具
开发环境:
VisualC++6.0
4.2个人设计实现(按组员分小节)
4.2.1曹奕设计实现
队列类的实现:
typedefstructQueueNode//队列结构
{
Cardata;
structQueueNode*next;
}QueueNode;
classQueue//定义队列类
{
public:
QueueNode*front,*rear;
Queue(){cout<<"构造函数"<~Queue();
intInitQueue();
intDestroyQueue(Queue*Q);
intEnterQueue(Queue*Q,Carc);
intEmptyQueue(Queue*Q);
intDeleteQueue(Queue*Q,Car*c);
intQueueLength(Queue*Q);
};
Queue:
:
~Queue(){cout<<"析构函数"<intQueue:
:
EmptyQueue(Queue*Q)
{
if(front==rear)
{
cout<<"队列为空"<return(TRUE);
}
else
cout<<"队列不为空"<return(FALSE);
}
intQueue:
:
InitQueue()
{
//构造一个空队列
front=(QueueNode*)malloc(sizeof(QueueNode));
if(front==NULL)
{
return(FALSE);
}
else
{
rear=front;
front->next=NULL;
cout<<"构造了一个空队列"<return(TRUE);
}
}
intQueue:
:
DestroyQueue(Queue*Q)
{
//销毁一个队列
while(front){
rear=front->next;
free(front);
front=rear;
}
cout<<"销毁队列成功"<return1;
}
intQueue:
:
EnterQueue(Queue*Q,Carc)
{
rear->next=(QueueNode*)malloc(sizeof(QueueNode));
if(rear->next==NULL)
{
cout<<"车辆入队失败"<return(FALSE);
}
else
{
rear=rear->next;
rear->data=c;
//rear->data.licence=rear->data.leaved;
cout<<"车辆入队成功"<rear->next=NULL;
count++;
return(TRUE);
}
}
intQueue:
:
DeleteQueue(Queue*Q,Car*c)
{
//删除队列元素
QueueNode*t;
if(EmptyQueue(Q))
{
cout<<"要查找车辆不存在!
"<return(FALSE);
}
else
{
t=front->next;
if(rear==t)
rear=front;
(*c)=t->data;
front->next=t->next;
free(t);
cout<<"车辆删除成功"<count--;
return(TRUE);
}
}
intQueue:
:
QueueLength(Queue*Q)
{
if(front!
=rear)
{
cout<<"此时队列长队为"<return1;
}
elsereturn0;
}
4.2.2王卓君设计实现
Time类:
#include
#include
#include
#include
#include
#include
#include
usingnamespacestd;
classTime//时间类
{
private:
SYSTEMTIMELocalTime;
intmonth;
intday;
inthour;
intminuet;
intsecond;
public:
Time()
{
GetLocalTime(&LocalTime);//取系统时间
}
voidOutputTime();//输出时间函数
intgetmonth(){returnLocalTime.wMonth;}
intgetday(){returnLocalTime.wDay;}
intgethour(){returnLocalTime.wHour;}
intgetminute(){returnLocalTime.wMinute;}
intgetsecond(){returnLocalTime.wSecond;}
voidsave()
{
month=getmonth();
day=getday();
hour=gethour();
minuet=getminute();
second=getsecond();
}
~Time(){}
};
voidTime:
:
OutputTime()//输出当前系统时间
{
cout<<"当前时间为:
"<}
//主函数
voidmain()
{
Timet;
t.OutputTime();
cout<<"现在是"<}
Guest类:
#include
#include
#include
#include
#include
#include
#include
staticintcarfre[100]={0};
//staticintcarid=0;
usingnamespacestd;
classTime//时间类
{
private:
SYSTEMTIMELocalTime;
intmonth;
intday;
inthour;
intminuet;
intsecond;
public:
Time()
{
GetLocalTime(&LocalTime);//取系统时间
}
voidOutputTime();//输出时间函数
intgetmonth(){returnLocalTime.wMonth;}
intgetday(){returnLocalTime.wDay;}
intgethour(){returnLocalTime.wHour;}
intgetminute(){returnLocalTime.wMinute;}
intgetsecond(){returnLocalTime.wSecond;}
voidsave()
{
month=getmonth();
day=getday();
hour=gethour();
minuet=getminute();
second=getsecond();
}
~Time(){}
};
voidTime:
:
OutputTime()//输出当前系统时间
{
cout<<"当前时间为:
"<#defineMAXSIZE100//链表的最大长度
typedefstruct{//线性表的静态单链表的存储结构
//chardata[10];
intdata;
intcur;
}component,SLinkList[MAXSIZE];
typedefstructCar
{
intleaved;
charlicence[LICENCESIZE];
Timearrive;
Timeleave;
}Car;
classGuest:
publicTime//客户类,继承Time类
{
public:
Timet1,t2;
SLinkListcarid;//该数组存车牌号
//chare[10];
inte;
intj,k,v;
intcartype;//车辆类型:
1客车2货车3轿车4越野车5跑车
floatprice;
public:
Guest(){
for(inti=1,m=0;i<=100,m<100;i++,m++)
{
carid[m].cur=i;
//carid[i].data="0000000";
}
//j=0;
}
~Guest(){}
intLocateElem(SLinkListcarid,int*e);//线性表定位函数,查找值为e的元素
voidsaveid(Car*c,intv);//该函数储存会员的车牌号和停车次数
floatfee(Timet1,Timet2);//计算价格函
floatcutprice(floatprice,intv);//计算打折价格函数
};
intGuest:
:
LocateElem(SLinkListcarid,int*e)//在静态单链线性表中查找第1个值为i的元素若找到,则返回它在表中的位序,否则返回下一位
{
k=0;
//while(k&&strcmp(carid[k].data,e)!
=0)//在表中顺链查找
while(carid[k].data!
=*e)
{
k=carid[k].cur;
if(!
carid[k].data)
{
j=k;
k=0;
returnj+1;
}
}
returnk+1;
}//LocateElem
floatGuest:
:
fee(Timet1,Timet2)//计算普通价格
{
if(t1.getmonth()!
=t2.getmonth())
price=(t2.getmonth()-t1.getmonth())*3000;
elseif(t1.getday()!
=t2.getday())
price=(t2.getday()-t1.getday())*500;
else
{
price=((t2.gethour()-t1.gethour())*3600+(t2.getsecond()-t1.getsecond())*60+(t2.getsecond()-t1.getsecond()))*CHARGE;
cout<<"您的车是什么类型?
1客车2货车3轿车4越野车5跑车"<cin>>cartype;
switch(cartype)//1客车2货车3轿车4越野车5跑车
{
case1:
case2:
price=price*2;
break;
case3:
price=price;
break;
case4:
price=price*1.5;
break;
case5:
price=price*1.2;
break;
}
}
returnprice;
}
floatGuest:
:
cutprice(floatprice,intv)//计算会员打折后的价格
{
//inti=LocateElem(carid,*e);
//调用线性表定位函数
if(carfre[v-1]>=100)
price=price*0.55;
elseif(carfre[v-1]>=50)
price=price*0.7;
elseif(carfre[v-1]>=20)
price=price*0.85;
else
price=price*0.95;
returnprice;
}
//LocateElem函数的测试函数
voidmain()
{
Guestguest;
inte;
SLinkListcarid;
for(intn=0,x=1111;n<5,x<=5555;n++,x=x+1111)
{
carid[n].data=x;
}
for(inti=1,m=0;i<=100,m<100;i++,m++)
{
carid[m].cur=i;
}
for(inty=5;y<100;y++)
{
carid[y].data=0;
}
cout<<"请输入要查询的值:
";
cin>>e;
cout<<"结果是存在第"<}
4.2.3张小玉设计实现
voidCarOut1(SqStack*parking1,SqStack*parking2,SqStack*temt,Queue*shortcutt)
{
inta;
charlicence[LICENCESIZE];
Carc;
Timet2;
t2.save();
Guestguest;
t2.OutputTime();
cout<<"★★★★★★★★请输入车牌号:
";
gets(licence);
printf("★★★★★★★★南停车场出车请输入0,北停车场出车请输入1.\n");
scanf("%d%*c",&a);
if(!
(a==1))
{
inti=0;
s1.sPop(&s1,&c);
while(strcmp(c.licence,licence)!
=0&&s1.top!
=0)
{
temt1.sPush(&temt1,c);
s1.sPop(&s1,&c);
i++;
}
c.leave=t2;
intx;
floatprice;
cout<<"★★★★★★★★您是否是会员?
1是2否★★★";cin>>x;
if(x==1)
{
price=guest.fee(c.arrive,c.leave);
price=guest.cutprice();
}
else
price=guest.fee(guest.t1,guest.t2);
cout<<"★★★★★★★★该车应付"<while(!
s1.sEmpty(&s1))
{
temt1.sPop(&temt1,&c);
s1.sPush(&s1,c);
}
if(!
shortcut.EmptyQueue(&shortcut))
{
shortcut.DeleteQueue(&shortcut,&c);
s1.sPush(&s1,c);
}
c.leave=t2;
printf("\n");
}
else
{
s2.sPop(&s2,&c);
while(strcmp(c.licence,licence)!
=0)
{
temt1.sPush(&temt1,c);
s2.sPop(&s2,&c);
}
c.leave=t2;
intx;
floatprice;
cout<<"★★★★★★★★您是否是会员?
★1是☆2否★★★";
cin>>x;
if(x==1)
{
price=guest.fee(c.arrive,c.leave);
price=guest.cutprice();
}
else
price=guest.fee(guest.t1,guest.t2);
cout<<"★★★★★★★★该车应付"<whi