1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
givi [52]
2 years ago
8

Create a script that will determine how many of each currency type are needed to make change for a given amount of dollar and ce

nts. Input Asks the user for a dollar and cents amount as a single decimal number. Output The program should indicate how many of each of these are needed for the given amount: $20 bills $10 bills $5 bills $1 bills Quarters ($0.25 coin) Dimes ($0.10 coin) Nickels ($0.05 coin) Pennies ($0.01 coin) If a dollar or coin is not needed (its quantity required is 0), do not print it.
Computers and Technology
1 answer:
Fantom [35]2 years ago
8 0

Answer:

The program in Python is as follows:

dollar = float(input("Dollars: "))

t20bill = int(dollar//20)

dollar -= t20bill * 20

t10bill = int(dollar//10)

dollar -= t10bill * 10

t5bill = int(dollar//5)

dollar -= t5bill * 5

t1bill = int(dollar//1)

dollar-= t1bill * 1

qtr = int(dollar//0.25)

dollar -= qtr * 0.25

dime = int(dollar//0.10)

dollar -= dime * 0.10

nkl = int(dollar//0.05)

dollar -= nkl * 0.05

pny = round(dollar/0.01)

if t20bill != 0:    print(t20bill,"$20 bills")

if t10bill != 0:    print(t10bill,"$10 bills")

if t5bill != 0:    print(t5bill,"$5 bills")

if t1bill != 0:    print(t1bill,"$1 bills")

if qtr != 0:    print(qtr,"quarters")

if dime != 0:    print(dime,"dimes")

if nkl != 0:    print(nkl,"nickels")

if pny != 0:    print(pny,"pennies")

Explanation:

This gets input for dollars

dollar = float(input("Dollars: "))

Calculate the number of $20 bills

t20bill = int(dollar//20)

Calculate the remaining dollars

dollar -= t20bill * 20

Calculate the number of $10 bills

t10bill = int(dollar//10)

Calculate the remaining dollars

dollar -= t10bill * 10

Calculate the number of $5 bills

t5bill = int(dollar//5)

Calculate the remaining dollars

dollar -= t5bill * 5

Calculate the number of $1 bills

t1bill = int(dollar//1)

Calculate the remaining dollars

dollar-= t1bill * 1

Calculate the number of quarter coins

qtr = int(dollar//0.25)

Calculate the remaining dollars

dollar -= qtr * 0.25

Calculate the number of dime coins

dime = int(dollar//0.10)

Calculate the remaining dollars

dollar -= dime * 0.10

Calculate the number of nickel coins

nkl = int(dollar//0.05)

Calculate the remaining dollars

dollar -= nkl * 0.05

Calculate the number of penny coins

pny = round(dollar/0.01)

The following print the number of bills or coins. The if statement is used to prevent printing of 0

<em>if t20bill != 0:    print(t20bill,"$20 bills")</em>

<em>if t10bill != 0:    print(t10bill,"$10 bills")</em>

<em>if t5bill != 0:    print(t5bill,"$5 bills")</em>

<em>if t1bill != 0:    print(t1bill,"$1 bills")</em>

<em>if qtr != 0:    print(qtr,"quarters")</em>

<em>if dime != 0:    print(dime,"dimes")</em>

<em>if nkl != 0:    print(nkl,"nickels")</em>

<em>if pny != 0:    print(pny,"pennies")</em>

You might be interested in
Multiple Choice
anygoal [31]

Answer:

cyptographically

Explanation:

Did this question and got it right. Good luck!

6 0
2 years ago
Mention one application of AI from the real world and describe the use of of this application what is the type of learning used
gayaneshka [121]

Answer:

The real world AI application is Google Duplex. It is able to receive orders for making reservations. Then it calls the shop or the place and deals with the person and talks to him very fluently and informs you about the reservation. Some other general types of AI application are Google Assistant, Siri , Amazon Alexa and so on. But google Duplex is lot more advanced than them.

4 0
2 years ago
IN MICROSOFT EXCEL YOU CAN UES FOMULA TO DIVIDE OR MULTIPLY WHAT IS THE CORRECT FORMULA TO CALCULATE 4*6
nexus9112 [7]

You actually have the correct answer. An excel formula starts with = so your answer would be =4*6

8 0
3 years ago
Which cell address indicates the intersection of the first row and the first column in worksheet?
Rzqust [24]

Answer:

A. A1

Explanation:

Worksheet's Columns are named with Alphabets. i.e. A,B,C,D,E....

And Worksheet's rows are named with numbers. i.e. 1,2,3,4,5....

So the intersection of first row number as "1" and First Column name as "A" is A1 as worksheet displays column name first and then row number.

8 0
3 years ago
Read 2 more answers
Type the correct answer in the box. Spell all words correctly.
diamong [38]
The answer is handouts.
A handout is a pamphlet with information on your presentation you can give to your audience
8 0
3 years ago
Other questions:
  • 4. Who developed the first design technology program which had a
    12·1 answer
  • Which of the following actions might contribute to recommendations you see online?
    6·1 answer
  • Can anyone can tell me and explain me the answer of it please .<br>thanks
    9·1 answer
  • What layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for defining a way to interpret
    11·1 answer
  • A technician is assigned a task to configure a new server with six hard drives. The senior administrator requested the technicia
    13·1 answer
  • What should be used to keep a tablet dry?
    13·1 answer
  • Dante went to change the date for an appointment in his Outlook calendar. He double-clicked in the appointment and made the chan
    11·1 answer
  • What is computer graphics? define​
    11·1 answer
  • What is the alogarithm for solving the perimeter of a triangle
    11·1 answer
  • IN EXCEL, File, menu , edit, insert are all located in ?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!