CSC171 Introduction to Computer Programming
Fall 2018
Homework 3


Click here for a solution to the lab exercise to compute the total value of a collection of coins.

Write an application that reads a floating point value from the user representing an amount of money (dollars and cents), and determines the equivalent amount of quarters, dimes, nickels, and pennies. For example, the output might look like this:

Enter an amount of money (in the format x.xx such that x is a digit): 0.99
You have 3 quarters, 2 dimes, 0 nickels, and 4 pennies.

Alternatively, your application may read an integer representing the total number of cents, and the output might look like this:

Enter the number of cents: 99
You have 3 quarters, 2 dimes, 0 nickels, and 4 pennies.

Readability counts for 20% of your grade. Choose appropriate names for your identifiers. Use comments and constants appropriately. Follow the programming conventions/guidelines we discussed.

Hand in a printout of your program and a printout of your outputs for the following test cases: 1) input amount is 0.99, 2) input amount is 0.41, and 3) input amount is 0.00 . The assignment should be done individually.

[Back to the Assignments Index]