Page 1 of 1

Commuters travelling on the trains can buy a fare card with a minimum stored value of $10. The fare card can be topped u

Posted: Wed Apr 27, 2022 3:08 pm
by answerhappygod
Commuters travelling on the trains can buy a fare card with a
minimum stored value of $10. The fare card can be topped up with a
minimum of $5 at any time. When a fare card is tapped at a boarding
station gate, its status is Active and the distance value in the
fare card is set to 0. When a fare card is tapped at an alighting
station gate, the application would calculate the distance
travelled and deduct the fare from the stored value in the fare
card. The fare card then becomes Inactive. If there is insufficient
stored value in the fare card, the station gate would not open and
the card continues to be Active. The commuter needs to top up the
fare card before he can tap at the alighting station gate. A
commuter may choose to return a fare card to the ticketing office
of any station and the stored value (if any) in the fare card would
be refunded to the commuter.
Draw a state machine diagram.