Computers and Technology
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)

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 12:20, jshhs
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
image
Computers and Technology, 23.06.2019 15:20, yeahmaneee
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
image
Computers and Technology, 23.06.2019 15:30, PlzNoToxicBan
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
Do you know the correct answer?
Programming in C++: Elevator conveyor systems date back to Roman times, as many different societies...

Questions in other subjects:

Konu
English, 01.04.2020 18:13
Konu
Mathematics, 01.04.2020 18:13