Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and write a Python program that gives exact change for an item purchased with $5 or less. Use a float data type to represent

Design and write a Python program that gives exact change for an item purchased with $5 or less. Use a float data type to represent money (You may want to multiply this number by 100 so that you get an integer for your calculation, such that $5.00 represents 500 cents, $2.35 represents 235 cents, etc.). Prompt the user to enter an item cost and an amount tendered. Both amounts must be 5.00 or less and the amount tendered must be greater than or equal to the cost of the item.

Your program will report the amount of change given: number of dollar bills, number of quarters, number of dimes, number of nickels and number of pennies, each with text indicating the money units.

For example, the expected output for an item that costs $2.71 when the amount tendered is $5.00, would be:

Dollars: 2

Quarters: 0

Dimes: 2

Nickels:1

Pennies:4

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

(c) What risk does the guaranteeing bank run?

Answered: 1 week ago

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago

Question

=+ c. a company president deciding whether to open a new factory

Answered: 1 week ago