Select Page

You should read this question as if the change giver is a bank teller who has to give amounts of money to customers but can’t count

You are asked to write a simple C program that will accept an integer value in the range of 5-95 and as a multiple of 5 representing the number of cents to give to a customer in their change.

The program should calculate how many coins are of each denomination and display this to the user. Valid coin values are 50, 20, 10 and 5. Your solution (program and algorithm) should be modular in nature. This requires the submission of a high-level algorithm and suitable decompositions of each step.

Note that for this problem the principle of code reuse is particularly important and a significant number of marks are allocated to this.

You should attempt to design your solution such that it consists of a relatively small number of functions that are as general in design as possible and you should have one function in particular that can be reused (called repeatedly) in order to solve the majority of the problem.

If you find that you have developed a large number of functions that each performs a similar task (or have a lot of repeated code) then attempt to analyse your design to generalise the logic so that it may be reused.