IN JS ONLY NEEDED SOLUTION Create a function that takes an amount of monetary change (e.g. 47 cents) and breaks down the most efficient way that change can be made using USD quarters, dimes, nickels and pennies. Your function should return an object. Coin Value Penny 0.01 Nickel 0.05 Dime 0.10 Quarter 0.25 Examples makeChange (47) makeChange (24) makeChange (92) S| { "q": 1, "d": 2, "n": 0, "p": 2 } { "q": 0, "d": 2, "n": 0, "p": 4 } { "q": 3, "d": 1, "n": 1, "p": 2 }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.4: A Case Study: Constructing A Date Class
Problem 4E
icon
Related questions
Question
IN JS ONLY NEEDED SOLUTION
Create a function that takes an amount of monetary change (e.g. 47 cents) and
breaks down the most efficient way that change can be made using USD
quarters, dimes, nickels and pennies. Your function should return an object.
Coin Value
Penny 0.01
Nickel 0.05
Dime 0.10
Quarter 0.25
Examples
makeChange (47) → { "q": 1, "d": 2, "n": 0, "p": 2 }
makeChange (24) → { "q": 0, "d": 2, "n": 0, "p":4}
makeChange (92) { "q": 3, "d": 1, "n": 1, "p": 2 }
S
Transcribed Image Text:IN JS ONLY NEEDED SOLUTION Create a function that takes an amount of monetary change (e.g. 47 cents) and breaks down the most efficient way that change can be made using USD quarters, dimes, nickels and pennies. Your function should return an object. Coin Value Penny 0.01 Nickel 0.05 Dime 0.10 Quarter 0.25 Examples makeChange (47) → { "q": 1, "d": 2, "n": 0, "p": 2 } makeChange (24) → { "q": 0, "d": 2, "n": 0, "p":4} makeChange (92) { "q": 3, "d": 1, "n": 1, "p": 2 } S
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr