Get the answers you need at Westonci.ca, where our expert community is always ready to help with accurate information. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

The price of an item you want to buy is given in dollars and cents. You pay for it in cash by giving the clerk d dollars and c cents. Write specifications for a function that computes the change, if any, that you should receive. Include a statement of purpose, the preconditions and postconditions, and a description of the arguments.

Sagot :

Answer:

Get the actual price of the item and convert it to cents, also get and convert the amount paid to cents.

subtract the actual price of the item from the paid amount ( which is in cents), if the result is greater than zero, covert the result back to dollars and output the result.

Explanation:

The program converts the actual price of the item and the amount paid to cents (where a dollar is equal to 100 cents). The variables are subtracted to get the change to be refunded, the result is converted back to dollars as the actual change to be paid.