[SOLVED] JavaScript program to make change

15.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (2 votes)

Write a JavaScript program to make change. You should use prompt() to read a string and parseInt() to convert the string into an integer number of cents (i.e. fractions of a dollar). Your program should write to the document how to deliver that number of cents as change using a minimum number of US coins as output. Ignore the 50 cent piece as a possible coin. So for example, given an input of 87, your program should output the following to the document:
87 cents is comprised of:
3 quarter(s)
1 dime(s)
0 nickle(s)
2 pennies
Hint: Remainders from division are calculated with the modulus operator.

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.