由电梯呼救按钮联想到的产品设计

1、现象:电梯中的紧急按钮放在下面,与开门,关门按钮相邻,这个设计的人应该没有用过这种电梯。
2、问题:很多人在使用的时候都会误按那个按钮,体验非常差。
3、分析:求救按钮应该设计在用户比较醒目,不容易误按;设计产品至少要体验过,以用户为维度去思考。

建立一座两层楼,一部电梯的模拟程序。为简化起见,每部电梯限乘一人,电梯每天在一楼关门等待。 三、具体要求及应提交的材料 模拟程序包括一个时钟,每天从零开始。模拟程序得调度器组件随机设置每一层第一个人到来的时间,当时钟的时间等于第一个人到来的时间时,模拟程序生成一个新到的人将该人放到这一层。然后这个人按下按钮,请求电梯开门。这个人的目的地楼层不能与他上电梯的楼层相同。 如果第一个人到达第一层,则可以在按下按钮、等待电梯开门之后立即进入电梯。如果第一个人在第2层,则电梯要升到第2层去接他。电梯从1层移到2层需要5秒。 电梯到达一层时,打开电梯门上的灯,并在电梯内发出铃声,该层的按钮电梯中表示该层的按钮复位,电梯门打开,乘客走出电梯(如果有到该层的乘客)。另一乘客(如果该层有人等待)进入电梯按下目的层按钮电梯们关上。电梯移动前确定移动方向(两层很容易判断),为简单起见,电梯到达一层直到关门所花时间为0。 任何时间每层最多只能有一人等待,如果新到的人(不在电梯中)要到达该层时该层被占用,则一秒后才能安排新到达者。假设每隔5到20秒人们随机到达每层。 要求: 对每个类(building,floor,elevator,person,button,time)设计一个头文件,存放类定义,建立一个程序,存放类的实现。例如floor.h,floor.cpp 输出结果用文字表示即可,如“Person1 arriveds on Floor1, Person 1 enters Elevator”等。
C++源代码 注重类的交互 片段 #include using namespace std; #include "elevator.h" //Elevator class definition #include "person.h" //Person class definition #include "floor.h" //Floor class definition //constants that represent time required to travel //between floors and direction of the elevator const int Elevator::ELEVATOR_TRAVEL_TIME = 5; const int Elevator::UP = 0; const int Elevator::DOWN = 1; //constructor Elevator::Elevator( Floor &firstFloor, Floor &secondFloor) : elevatorButton( * this ), currentBuildingClockTime( 0 ), moving( false ), direction( UP ), currentFloor( Floor::FLOOR1 ), arrivalTime( 0 ), floor1NeedsService( false ), floor2NeedsService( false ), floor1Ref( firstFloor ), floor2Ref( secondFloor ), passengerPtr( 0 ) { cout << "elevator constrcuted" <<endl; }// end Elevator constructor //destructor Elevator::~Elevator() { delete passengerPtr; cout << "elevator destructed" << endl; }//end Elevator destructor //give time to elevator void Elevator::processTime( int time ) { currentBuildingClockTime = time; if ( moving ) //elevator is moving processPossibleArrival(); else processPossibleDeparture(); if ( !moving ) cout << "elevator at rest on floor " << currentFloor << endl; }// end function processTime // when elevator is moving, determine if it should stop void Elevator::processPossibleArrival() { //if elevator arrives at destination floor if ( currentBuildingClockTime == arrivalTime ) { currentFloor = ( currentFloor == Floor::FLOOR1 ? Floor::FLOOR2 : Floor::FLOOR1); //update current floor direction = ( currentFloor == Floor::FLOOR1 ? UP : DOWN ); //update direction cout << "elevator arrives on floor " << currentFloor <<endl; // process arrival at currentFloor arriveAtFloor( currentFloor == Floor::FLOOR1 ? floor1Ref : floor2Ref); return; }//end if //elevator still moving cout << "elevator moving " << ( direction == UP ? "UP" : "DOWN"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值