So the third assignment is to be able to return the balance that is left in the vending machine you should return it back to the user.
So in this case.
What I’m going to do is I’m going to say add a quarter.
And it says you have entered state 25.
And if I say return my balance you should say okay I have returned your balance of 25 cents your remaining balance is now zero cents you can check that by asking for a product give me a Snickers.
And you see that it says you need at least 25 cents to buy a Snickers your current balance is zero cents.
So let’s try again add a quarter.
And let’s add another quarter.
And now we can say return I balance.
And it says okay I have returned your balance of 50 cents your remaining balance is now zero cents.
And once again if we were to ask for a product give me a Twix it says your balance must be at least 50 cents to buy a Pro-X [m1] your current balance is zero since so you can see that not only is it responding with the fact that it’s return the balance but you should also go to the appropriate state where it’s got a zero balance which is basically the start State.
So this is going to be the third assignment.
And once again I will emphasize that you should be able to do all the three assignments just based on whatever we have learnt till now.
And you should just it’s a it’s in I will say it’s tedious.
And it’s a little bit involved but it’s definitely not very complicated.
And if you find that it’s complicated then that means you haven’t really understood the concept of the state machine very well so once you understand what the state machine is.
And how it’s supposed to work implementing these three assignments should it could take you some time but it should not be too difficult to do