Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ please answer all This project is to develop a program in C++ to control an elevator in a 5-story building The first floor has
C++ please answer all
This project is to develop a program in C++ to control an elevator in a 5-story building The first floor has one button, the "up" button, on the panel. The top floor only has the "down" button on the panel. In the elevator car, there are buttons from 1 to 5 indicating floor numbers and a panic button "stop". The program should simulate the process with the following assumptions 1. The elevator needs 10 seconds for any move, up and down, between any two floors. 2. The elevator buttons have higher priority than floor buttons 3. The "stop" button has the highest priority. When the stop button is pressed, the elevator should stop at the nearest floor in its moving direction. 4. The program checks all button statuses in every 2 seconds. 5. At most one button may be pressed in every 2 seconds. 6. The elevator initially stays on the first floor. An input data file should be prepared to simulate the passenger behaviors. Each line has the following binary numbers (0 or 1) separated by spaces. 0 means the button is not pressed. 1 means the button is pressed. Each line represents the status of every 2 seconds. DownU 0 Down4 Down5 Buttn Button2 Button Button4Button Sto 0 0 0 0 0 0 0 The output file should have the floor number of 1,2,3,4,5 representing the floor on which elevator is located at each moment. This project is to develop a program in C++ to control an elevator in a 5-story building The first floor has one button, the "up" button, on the panel. The top floor only has the "down" button on the panel. In the elevator car, there are buttons from 1 to 5 indicating floor numbers and a panic button "stop". The program should simulate the process with the following assumptions 1. The elevator needs 10 seconds for any move, up and down, between any two floors. 2. The elevator buttons have higher priority than floor buttons 3. The "stop" button has the highest priority. When the stop button is pressed, the elevator should stop at the nearest floor in its moving direction. 4. The program checks all button statuses in every 2 seconds. 5. At most one button may be pressed in every 2 seconds. 6. The elevator initially stays on the first floor. An input data file should be prepared to simulate the passenger behaviors. Each line has the following binary numbers (0 or 1) separated by spaces. 0 means the button is not pressed. 1 means the button is pressed. Each line represents the status of every 2 seconds. DownU 0 Down4 Down5 Buttn Button2 Button Button4Button Sto 0 0 0 0 0 0 0 The output file should have the floor number of 1,2,3,4,5 representing the floor on which elevator is located at each moment
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started