Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pyhton : Write a program called dollarsAndPennies what it does: 1 . ask the user for an amount of money specified in dollars and cents.

Pyhton :
Write a program called dollarsAndPennies
what it does:
1. ask the user for an amount of money specified in dollars and
cents. For example, the user might enter: 23.41
2. your program must output maximum number of 100 dollar bills that
fit in the amount, then the maximum number of fifty dollar bills,
then 20, then 10,5 and 1. After that, display maximum number of
quarters, number of dimes, nickels and pennies.
3. For example $100 could be displayed as 10000 pennies, or 2 fifty
dollar bills or 5 twenty dollar bills. But the correct answer is
the maximum number of 100 dollar bills first: 1 one hundred
dollar bill. Look at the examples.
HINT: remember: in python // is integer division. so:
125//100 is 1
also % computes the remainder, so:
125%100 is 25
Examples:
% python3 dollarsAndPennies.py
enter amount: 100.13
total: 100.13
1100 dollar bills
050 dollar bills
020 dollar bills
010 dollar bills
05 dollar bills
01 dollar bills
025 cent coins
110 cent coins
05 cent coins
31 cent coins
% python3 dollarsAndPennies.py
enter amount: 186.41
total: 186.41
1100 dollar bills
150 dollar bills
120 dollar bills
110 dollar bills
15 dollar bills
11 dollar bills
125 cent coins
110 cent coins
15 cent coins
11 cent coins
% python3 dollarsAndPennies.py
enter amount: 1234.56
total: 1234.56
12100 dollar bills
050 dollar bills
120 dollar bills
110 dollar bills
05 dollar bills
41 dollar bills
225 cent coins
010 cent coins
15 cent coins
11 cent coins
%

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

What are the risks associated with fundinggap risk?

Answered: 1 week ago