subject
Computers and Technology, 14.07.2021 14:00 100888

Programming in C++: Elevator conveyor systems date back to Roman times, as many different societies realized the need to lift and lower people and things. For this assignment, suppose that a sensor is recording the different tasks an elevator performs. For example, consider the elevator string:

M1

This string indicates that the elevator has been called to first floor. At this point, suppose the doors open and three people come aboard. This would correspond to the elevator string:

M1O+3

Alternatively, an equivalent elevator string could say:

M1O+1+1+1

Now suppose the elevator closes it doors and moves to floor 5. This would correspond to the elevator string:

M1O+1+1+1CM5

At this point, suppose two people walk off the elevator and then four new people come aboard. This would correspond to the elevator string:

M1O+1+1+1CM5O-2+4

Alternatively, an equivalent elevator string could say:

M1O+3CM5O+1+1+1+1-1-1

Precisely, to be a valid elevator string,

- the only characters present should be M, O, C, +, - and digit characters
- by convention, elevators always start with the doors closed
- an elevator string must begin with M followed by digits
- elevators doors can only be opened if they are currently closed; elevator doors can only be closed if they are currently open
- once elevator doors are opened, passengers can board via + followed by digits
- once elevator doors are opened, passengers can leave via - followed by digits
- doors must be closed before the elevator can be called to a different floor
- elevator strings must end with either O, C or a digit character and not a +, - or M

All of the following are examples of valid elevator strings:

M12 (elevator called to floor 12)
M12O+1-0C (elevator called to floor 12, doors open, one passenger aboard, doors close)
M12O+1CM3 (elevator called to floor 12, doors open, one passenger aboard, doors close, elevator called to floor 3)
M0 (floor zero is allowed and valid)
M1O+0004C (extra leading zeros are allowed)
M3O+3COCOCM2 (door can be opened if presently closed, doors can be closed if presently open)
M12O+1-1+1-1+1 (folks can get on and off)
M10M8M9 (moving between floors)
M2OCOC (valid)
M2OCM1 (valid)
M2OCO (valid)
M2O+3CO-1CO (valid)
All of the following are examples of invalid elevator strings:

M (elevator needs to be called to a floor)
M1C (elevator start with doors closed; once closed, doors cannot be closed again)
M1OCOO (once doors are open, doors cannot be opened again)
M1O-12+50 (passenger count cannot go negative as the elevator string is processed)
M1O+4-3-1CM2O-1 (passenger count cannot go negative as the elevator string is processed)
M1O+-C (+ and - must be followed by digit characters)
M-3 (only above ground floors)

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
What are two of the most common reasons that peolpe who need mental health care do not access it?
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Competent nonverbal communication involves interacting with others in a manner that is appropriate for which of the following? select all that apply. situation task individuals
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 06:00
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
You know the right answer?
Programming in C++: Elevator conveyor systems date back to Roman times, as many different societies...
Questions
question
Chemistry, 19.03.2020 17:59
question
Social Studies, 19.03.2020 17:59
Questions on the website: 13722362