# Homework 1 Solution

CS17

40 pts.

1. As precisely as possible write down, in plain English, the sequence of steps necessary in making change. Assume that the person making change has an infinite supply of quarters, dimes, nickels, and pennies. (I wish I were that person!) You may assume that the amount of change to be returned is less than \$1.00. The catch is that your set of instructions must guarantee that the minimum number of coins is returned.

I've written my solution in pseudocode. There was no requirement to do so.

```let change = the amount of change to be returned

while change >= 25
begin
return 1 quarter
let change = change - 25
end
end_while

while change >= 10
begin
return 1 dime
let change = change - 10
end
end_while

while change >= 5
begin
return 1 nickel
let change = change - 5
end
end_while

return change pennies
```

Compare this solution to the program that we worked on in class on Feb. 23. Do you notice how similar they are?

2. I didn't plan on providing a solution to this problem, because it's an essay. I'll be happy to discuss anything with you individually.

Thomas P. Kelliher
Thu Feb 22 21:53:41 EST 1996
Tom Kelliher