5th floors. The elevator can travel going up (unless they are at the 5th floor) or going down (unless they are at the ground floor). The elevator can only contain one passenger (which is the current user of the program). Initially the elevator begins and loads at the Ground Floor. If the user wants to travel to the 5th floor, the elevator shall go up to the said floor. It is the option of the user if they want to alight the elevator or not on the 5th floor or any floor on the way. Realistic rules should apply: If the user alights at the 4th floor, when they ride the elevator again, it should begin traveling from the 4th floor and from there choose to go up or down. Your program should have some validation: meaning, only the valid characters should be rec

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Program needs to be written in C.

Elevator Simulator
Simulate an Elevator-Controller Program. The Elevator should be able to travel between five floors
namely Ground, 1st, 2nd, 3rd, 4th and 5th floors. The elevator can travel going up (unless they are
at the 5th floor) or going down (unless they are at the ground floor). The elevator can only contain
one passenger (which is the current user of the program). Initially the elevator begins and loads at
the Ground Floor. If the user wants to travel to the 5th floor, the elevator shall go up to the said
floor. It is the option of the user if they want to alight the elevator or not on the 5th floor or any
floor on the way.
Realistic rules should apply: If the user alights at the 4th floor, when they ride the elevator again, it
should begin traveling from the 4th floor and from there choose to go up or down. Your program
should have some validation: meaning, only the valid characters should be received by the program
(G, 1, 2, 3, 4, 5). If the user keys-in “A” or “-1”, the program should be able to handle such input and
not crash and ask for a correct valid input.
Keep your program modular (use functions), and apply all lessons and concepts learned in class.
Indicate in the comments (per item) all the lessons and concepts used and if possible indicate the
specific parts and syntax applied.
The elevator can also travel from B1 to B3 (Basement 1 to 3). The elevator can also allow new
passengers to ride the elevator during the trip of the first user. The number of passengers per trip
can vary.
Do not use GOTO statements.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

I have these errors which you can see in this screenshot.

 

A
pavle11@pavle11-ubuntu:~$ gcc elevator.c
elevator.c:5:26: error: stray '\302' in program
5 | #define MAX_PASSENGERS 10
elevator.c:11:25: note: in expansion of macro 'MAX_PASSENGERS
11 | char passenger_floors [MAX_PASSENGERS ] [3]; // 2D array to store destination floors of each passenger
elevator.c: In function 'main':
elevator.c:27:1: error: stray '1302' in program
27 |
elevator.c: In function 'get_destination_floor':
elevator.c:60:1: error: stray '1302' in program
60 |
elevator.c: In function 'add_passenger':
elevator.c:5:26: error: stray 1302' in program
5 | #define MAX_PASSENGERS 10
elevator.c:98:54: note: in expansion of macro 'MAX_PASSENGERS'
98 | while (choice == 'Y' && elevator->num_passengers < MAX_PASSENGERS) {
elevator.c:99:1: error: stray '1302' in program
99 |
|
elevator.c:5:26: error: stray '\302' in program
5 | #define MAX_PASSENGERS 10
elevator.c:103:36: note: in expansion of macro 'MAX_PASSENGERS'
103 |
if (elevator->num_passengers <MAX_PASSENGERS) {
elevator.c: In function 'remove_passenger':
elevator.c:112:1: error: stray '\302' in program
112 |
elevator.c:112:2: error: stray '1302' in program
112 |
elevator.c: In function 'move_elevator':
elevator.c:124:1: error: stray '\302' in program
124 |
A
elevator.c:124:2: error: stray '\302' in program
124 |
elevator.c:131:1: error: stray '\302' in program
131 |
pavle11@pavle11-ubuntu: ~
pavle11@pavle11-ubuntu:~$
Q =
Transcribed Image Text:A pavle11@pavle11-ubuntu:~$ gcc elevator.c elevator.c:5:26: error: stray '\302' in program 5 | #define MAX_PASSENGERS 10 elevator.c:11:25: note: in expansion of macro 'MAX_PASSENGERS 11 | char passenger_floors [MAX_PASSENGERS ] [3]; // 2D array to store destination floors of each passenger elevator.c: In function 'main': elevator.c:27:1: error: stray '1302' in program 27 | elevator.c: In function 'get_destination_floor': elevator.c:60:1: error: stray '1302' in program 60 | elevator.c: In function 'add_passenger': elevator.c:5:26: error: stray 1302' in program 5 | #define MAX_PASSENGERS 10 elevator.c:98:54: note: in expansion of macro 'MAX_PASSENGERS' 98 | while (choice == 'Y' && elevator->num_passengers < MAX_PASSENGERS) { elevator.c:99:1: error: stray '1302' in program 99 | | elevator.c:5:26: error: stray '\302' in program 5 | #define MAX_PASSENGERS 10 elevator.c:103:36: note: in expansion of macro 'MAX_PASSENGERS' 103 | if (elevator->num_passengers <MAX_PASSENGERS) { elevator.c: In function 'remove_passenger': elevator.c:112:1: error: stray '\302' in program 112 | elevator.c:112:2: error: stray '1302' in program 112 | elevator.c: In function 'move_elevator': elevator.c:124:1: error: stray '\302' in program 124 | A elevator.c:124:2: error: stray '\302' in program 124 | elevator.c:131:1: error: stray '\302' in program 131 | pavle11@pavle11-ubuntu: ~ pavle11@pavle11-ubuntu:~$ Q =
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY