You are on page 1of 1

Republic of the Philippines

Laguna State Polytechnic University


Province of Laguna

College of Computer Studies


CMSC 204

Esteban,Marc Steven J. 4/24/2021

BSCS-2A

THE ELEVATOR PROBLEM

An elevator remains positioned at the ground floor level of a building with the
doors shut whenever it is not in use. When a call button is pressed on any
floor, the lift moves to the required floor and the elevator doors open. Write
an algorithm to express the logic of controlling the lift.

Pseudocode Flowchart

BEGIN MAIN PROGRAM BEGIN

IF

The call button is pressed


If call True
THEN False
button is
pressed
The elvator lift moves to the required
The elevator The elevator moves
floor and the door open remain pose at to the required floor
ground floor level and the door will
ELSE the door will open
remain close
The elevator remains positioned at the

ground floor the door remains close

END IF
END
END MAINPROGRAM

Since the elevator problem has two possible paths depending on whether or not the
call button was pressed, I used the Binary Selection solution structure.

You might also like