I am stuck trying to create a program in PYTHON that calculates the coins needed to make change for a specified US monetary amount.Here is the code I have so far# Module 3 Change Calculator# Program is to take a given dollar amount, and convert it into coinsdollar_amount = 1##quarters = .25##dimes = .1##nickels = .5##pennies = 01print("Enter dollar amount (for example, .56, 7.85): ")dollar_amount = inputif dollar_amount < 0:print("Error, dollar amount must be positive.")else:quarters = dollar_amount // 25dimes = (dollar_amount % 25) // 10nickels = dollar_amount % 25 % 10 // 5pennies = dollar_amount % 5print("The number of coins for ", dollar_amount, "dollars are: "print("Quarters: + , quarters")print("Dimes:" +, dimes)print("Nickels: " +, nickels)print("Pennies: " +, pennies)

Question
Asked Feb 3, 2019
2 views

I am stuck trying to create a program in PYTHON that calculates the coins needed to make change for a specified US monetary amount.

Here is the code I have so far

# Module 3 Change Calculator
# Program is to take a given dollar amount, and convert it into coins

dollar_amount = 1
##quarters = .25
##dimes = .1
##nickels = .5
##pennies = 01

print("Enter dollar amount (for example, .56, 7.85): ")

dollar_amount = input

if dollar_amount < 0:
print("Error, dollar amount must be positive.")
else:
quarters = dollar_amount // 25
dimes = (dollar_amount % 25) // 10
nickels = dollar_amount % 25 % 10 // 5
pennies = dollar_amount % 5

print("The number of coins for ", dollar_amount, "dollars are: "
print("Quarters: + , quarters")
print("Dimes:" +, dimes)
print("Nickels: " +, nickels)
print("Pennies: " +, pennies)

Expert Answer

1 Rating

Want to see the step-by-step answer?

See Answer

Check out a sample Q&A here.

Want to see this answer and more?

Step-by-step answers are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Answer
*Response times may vary by subject and question.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A

Q: AskForNumbers Declare an integer array locally with the size of 200. Create a program that asks the ...

A: In order to implement the question mentions a method called getChoice() information about which has ...

Q: do big data could replace the artistic vision of a creative director? and why?

A: Justification:“Yes”, big data replace the artistic vision of a creative director.

Q: Construct an npda corresponding to the grammar S→aABB|aAA,A→aBB|b,B→bBB|A.

A: Firstly, we will convert the given grammar into GNFS → aABB|aAAA → aBB|bB → bBB|aBB|a

Q: • Write a program in Eclipse that computes future investment value at a given interest rate for a sp...

A: Program plan:Import necessary packages.Define a class named “Investment”.Define a method named “comp...

Q: Prove that the following languages are not regular: (b) L = {anblak : k ≠ n + l}.

A: First, assume the given language is regular.Then apply pumping lemma to prove the statement is not r...

Q: Draw a half-adder using only NAND gates.

A: Half adder is basically a combinational circuit which executes simple basic addition of two binary n...

Q: Problem Description: The international standard letter/number mapping found on the telephone keypad ...

A: The pseudocode is as follows:Prompt user for a letter in upper caseReceive the input.Convert the use...

Q: Assume that you have been tasked by your employer to develop an incident response plan. Create a lis...

A: Stakeholder:A stakeholder can be a person, a group, or an organization that has an affair or matter ...

Q: Write a grammar for the language consisting of strings built only of theletters aand b. The strings ...

A: The given language L contains the strings that have infinite number of letters but the strings must ...