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:30
Communication is the exchange of information. true false
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
1. which of the following is a search engine? a) mozilla firefox b)internet explorer c)google d)safari 2. which of the following statements is true? a) all search engines will provide the same results when you enter the same query. b) all search engines use the same amount of advertisements. c) some search engines are also browsers. d) search engines often provide different results, even when you enter the same query.
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
The option enables you to modify a slide element in most presentation applications.
Answers: 2
You know the right answer?
Programming in C++: Elevator conveyor systems date back to Roman times, as many different societies...
Questions
question
Computers and Technology, 12.09.2019 05:30
question
Mathematics, 12.09.2019 05:30
question
Mathematics, 12.09.2019 05:30