volume_mute

State Diagram for a Filling Station System

publish date1969/12/31 00:00:00 UTC

volume_mute

A fully automated filling (gas) station requires a state diagram. A driver swipes a card, credit is verified, fuel is dispensed, and the account is debited after the hose is returned. Which of the following represents the correct sequence of states?

Correct Answer

Idle → CardReading → CardVerification → FuelAuthorized → Fuelling → HoseReturned → Billing → CardReturned → Idle

Explanation

The filling station state machine: Idle (waiting for a customer) → CardReading (card swiped through reader) → CardVerification (communication with credit company, fuel limit established) → FuelAuthorized (card valid, pump enabled) → Fuelling (driver takes fuel) → HoseReturned (hose returned to holster) → Billing (account debited for cost of fuel taken) → CardReturned (valid card returned; if invalid, card returned before fuelling) → Idle. If the card is invalid, the pump returns the card before fuel is dispensed.

Reference

Software Engineering, Ian Sommerville, 10th edition


Quizzes you can take where this question appears