Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2: (5 marks) Imagine you are running a store, and you have access to cash in different denominations, 20, 10, 5 and 1 for

Problem 2: (5 marks) Imagine you are running a store, and you have access to cash in different denominations, 20, 10, 5 and 1 for the dollars; quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies (1 cent) for the rest. Write a code that receives an amount of money as input and says how to build that number using your cash and using the least amount of bills/coins as possible. (Hint: Integer division and modulus are very useful here) Example Input: Tell me how much money: 73.17 Output Twenties= 3 Tens= 1 Fives= 0 Dollars= 3 Quarters= 0 Dimes= 1 Nickels= 1 Pennies= 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions