Final answer:
To construct a finite-state machine for a newspaper vending machine, follow these steps: Define the states and transitions, including conditions for opening the door. Start with the initial state S0, and transition to states S1, S2, and S3 based on the insertion of coins. Transition back to S0 after opening the door.
Step-by-step explanation:
To construct a finite-state machine that models a newspaper vending machine, we can start by defining the states and transitions that represent the different scenarios. Let's denote the states as S0, S1, S2, and S3. The transitions will represent the insertion of coins and the conditions for opening the door. Here is the step-by-step explanation:
Start with the initial state S0, representing no credit.
When a dime is inserted, transition to state S1.
When another dime is inserted, transition to state S2.
When a third dime is inserted, transition to state S3 (door can be opened).
Alternatively, when a quarter and a nickel are inserted, transition directly from S0 to S3 (door can be opened).
Once the door is opened, transition back to S0 (next customer starts with no credit).