Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a money amount in dollars (floating point number), one needs to find out how many minimum numbers of total coins (including quarters, dimes, nickels

Given a money amount in dollars (floating point number), one needs to find out how many minimum numbers of total coins (including quarters, dimes, nickels and pennies) will be needed to make this amount. You need to write a program, that will take an user input for the money amount and then first convert the complete amount in cents (declare cents as integer).

Then first determine, how many quarters by dividing that amount by 25, and the remainder amount then divide by 10, and find how many dimes, and continue, the remainder after finding the nickels will be all pennies.

The algorithm is simple:

Quarters = cents / 25 cents = cents % 25

Dimes = cents / 10

cents = cents %10

etc.

Display number of quarters, dimes, nickels, and pennies and also the total number of coins by adding Quarters + Dimes + Nickels + Cents

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

Step: 3

blur-text-image

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions