Delphi task

Posted by stephen on October 15, 2005

Hi there,
I need help ... I have to solve the following task in Delphi.

A person buys goods and everytime the person receives change. The aim is that the person has as few as possible coins in its wallet. The person has an unlimited value of one dollar coins. And at the beginning 5 1 cent coint, 5 2 cent coins, 5 5 cent coins, 5 10 cent coins, 5 20 cent coins and 5 fifty cent coins in his wallet.

I shall simulate as many times as the programs user wants an amount the person has to pay (between 0.05$ and 30.00$). The program shall return which coins I shall give to the cashier (for each amount). The cashier always gives as few small change as possible. The person has everytime enough 1$-coins (or notes) and only wants to have as few 1cent, 2cent, 5cent, 10cent, 20cent, 50cent coins as possible in his wallet. I don't really know how I shall solve that I would be very nice if you try to help me

It should be programmed with Delphi (5 or 7)

Related Articles and Replies