Write a function called Change that takes two parameters (cost, the amount of a transaction, and cash, the amount that a customer paid) and returns the amount of change that the customer should receive.
This sounds like a typical homework question. We're not going to help you unless you show us some attempts to at least try it. Fundamentally, this should be a very easy task... it is subtraction, perhaps with a check to ensure that the values are not negative and that the customer paid enough money.
Answers
This sounds like a typical homework question. We're not going to help you unless you show us some attempts to at least try it. Fundamentally, this should be a very easy task... it is subtraction, perhaps with a check to ensure that the values are not negative and that the customer paid enough money.