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
Need help asap please
Bumek [7]

Answer:

options is right

Explanation:

3 0
2 years ago
8. Software ____ are individual programs that can be purchased, installed, and run separately, but extract data from the common
oee [108]
System software are software that can be installed and run separately
6 0
2 years ago
Which of the following is true of the poka-yoke approach used for mistake-proofing processes?
Svetradugi [14.3K]

Answer:  b)It helps to engage workers in continuous improvement activities.

Explanation: Poke-yoke method was the technique to eliminate the mistakes that happen in a manufacturing process. It helps in avoiding the issues in the product and correcting those errors.

Mistake proofing is the mechanism of this methods that ensures about the product manufactured is safe from any failure and defects.It alerts the workers to improve the product through their working.

Other options are incorrect because it was developed by Shigeo Shingo , they had easy mechanism and feedback system did not told the workers about defects.Thus, the correct option is option(b).

7 0
2 years ago
Read 2 more answers
Will technology be the destruction or salvation of human-kind
Delicious77 [7]

MARK ME As BRAINLIEST

Answer is salvation
5 0
3 years ago
Read 2 more answers
Need answer ASAP
kaheart [24]

Answer:

D. To ensure that the software adheres to technical standards

Explanation:

The responsibility of the software architect is to ensure that all parts of the software system are able to meet the requirements set forth by the project or specifications, in this case, the technical standards.  This is an important piece of the software system because without it, the software system may not perform the necessary functions that it was written to do.

Cheers.

5 0
2 years ago
Other questions:
  • Students recently created a Gaming Club at their school. On Friday of every week, students bring in their gaming consoles (Xbox,
    10·1 answer
  • What is the term for the process of gathering information through images taken at a distance?
    13·1 answer
  • Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s: Diameter (2
    7·1 answer
  • How to fix dark images?<br><br>I am using a phone btw​
    14·2 answers
  • All portions, to include subject, title, paragraphs, sub-paragraphs, graphics, tables, charts, and bullet statements, must be pr
    12·1 answer
  • Choose the term that matches the action.
    5·2 answers
  • What can the tab key do
    10·1 answer
  • Hey guys, I don’t have a problem for you but If anyone knows do you still pass your grade level if you failed 1 class in the las
    11·2 answers
  • Cual
    5·1 answer
  • Consider the following code: def tryIt(b): for i in range(len(b)): b[i] = b[i] + 100 #***********MAIN************ x = [] x = [56
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!