Bird
Raised Fist0

Which class should contain the attribute that stores the floor number in an elevator system?

easy🧠 Conceptual Q2 of Q15
LLD - Design — Elevator System
Which class should contain the attribute that stores the floor number in an elevator system?
ARequest
BBuilding
CElevator
DFloor
Step-by-Step Solution
Solution:
  1. Step 1: Identify which class represents floors

    The Floor class logically represents each floor and should store its number.
  2. Step 2: Eliminate other classes

    Request stores user requests, Elevator moves, Building is a container but doesn't store floor numbers directly.
  3. Final Answer:

    Floor -> Option D
  4. Quick Check:

    Floor class stores floor number [OK]
Quick Trick: Floor class holds floor number, not Elevator or Request [OK]
Common Mistakes:
MISTAKES
  • Assigning floor number to Elevator
  • Confusing Request with Floor
  • Assuming Building stores floor numbers directly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes