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
Gnoma [55]
2 years ago
11

Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li

ne. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. If the input is 0 or less, output: no change. If the input is 45, the output is:
1 quarter 2 dimes
Computers and Technology
1 answer:
Contact [7]2 years ago
3 0

Answer:

The program in python programming language is as follows

amount = int(input("Enter Amount:  "))

#Check if input is less than 1

if amount<=0:

     print("No Change")

else: #If otherwise

     #Convert amount to various coins

     dollar = int(amount/100) #Convert to dollar

     amount = amount % 100 #Get remainder after conversion

     quarter = int(amount/25) #Convert to quarters

     amount = amount % 25 #Get remainder after conversion

     dime = int(amount/10) #Convert to dimes

     amount = amount % 10 #Get remainder after conversion

     nickel = int(amount/5) #Convert to nickel

     penny = amount % 5 #Get remainder after conversion

     #Print results

     if dollar >= 1:

           if dollar == 1:

                 print(str(dollar)+" dollar")

           else:

                 print(str(dollar)+" dollars")

     if quarter >= 1:

           if quarter == 1:

                 print(str(quarter)+" quarter")

           else:

                 print(str(quarter)+" quarters")

     if dime >= 1:

           if dime == 1:

                 print(str(dime)+" dime")

           else:

                 print(str(dime)+" dimes")

     if nickel >= 1:

           if nickel == 1:

                 print(str(nickel)+" nickel")

           else:

                 print(str(nickel)+" nickels")

     if penny >= 1:

           if penny == 1:

                 print(str(penny)+" penny")

           else:

                 print(str(penny)+" pennies")

Explanation:

The program is written in python programming language and it uses comments to explain some lines

Variable amount is declared as integer

Line 3 checks if amount is less than or equal to 0

If yes, the program outputs No Change

Else, it converts the input amount to lesser coins

Line 7 of the program gets the dollar equivalent of the input amount

Line 8 gets the remainder

Line 9 gets the quarter equivalent of the remainder

Line 10 gets the remainder

Line 11 gets the dime equivalent of the remainder

Line 12 gets the remainder

Line 13 gets the nickel equivalent of the remainder

Line 14 gets the penny equivalent of the remainder

Line 16 till the end of the program prints the output and it uses appropriates name (singular and plural)

You might be interested in
Helen is filling her persönal details on her résumé. Which detail should she include in this section?
svetoff [14.1K]

I would think option A.

b doesn't give enough information and c would go under last work experience

4 0
2 years ago
1.<br> The correct way to use a seat belt is
Nesterboy [21]

Answer:

4 steps

Explanation:

Step 1: Pull belt across body

Sit in any of your vehicle's seats and secure the three-point harness in its buckle by pulling it across your body.

If the seatbelt is too short, consider an aftermarket restraint and extender. Make sure they meet federal safety standards and are installed professionally.

Step 2: Adjust lower belt

Adjust the lower belt snuggly across your lap and pelvis area – never your stomach.

Pregnant women should wear the lap belt below their belly, not on or above it.

Step 3: Adjust shoulder belt

Adjust the shoulder belt to fit comfortably across the collarbone and chest. It should never rub on your neck or face. Never put the shoulder belt behind your back or under your arm.

Step 4: Check before driving

Check that the belt is secure before driving.

4 0
2 years ago
I got a 52 on my test :(
Eduardwww [97]

Answer:

that sucks i hope u can do better next time have a good day

Explanation:

7 0
3 years ago
Please help! I don’t know the answer to it :( it’s Fashion marketing
Oxana [17]

Answer:

I believe the answer should be C)

Sorry if it’s wrong,but hope it helps

8 0
2 years ago
3. For “Incident Energy Analysis” What body parts are involved in the distance
krek1111 [17]

The body part that is close to the arc flash boundary is the energized conductors or circuit parts.

<h3>What is the distance of an arc flash?</h3>

The working distance is known to be the distance that exist between a person and the center of an arc flash.

Note that The body part that is close to the arc flash boundary is the energized conductors or circuit parts.

Learn more about Energy from

brainly.com/question/13881533

#SPJ1

7 0
1 year ago
Other questions:
  • Write a program totake a depth (in kilometers) inside the earth as input data;compute
    15·1 answer
  • Janice has a "jammed" key on her keyboard. Every time she strikes the "S" key it sticks and doesn't pop back. What should Janice
    6·2 answers
  • The linux and macos program traceroute is known by a slightly different name on windows. it's referred to as ______.
    5·1 answer
  • Wice each lunar month, all year long, these tides occur. Whenever the Moon, Earth and Sun are aligned, the gravitational pull of
    5·1 answer
  • Transmits data as pulses of light through tiny tubes of glass Uses standard telephone lines to create a high-speed connection Co
    5·1 answer
  • Often duties and taxes are imposed on cars that are imported fron other countries. What type of incentives are these duties and
    12·1 answer
  • Which option nukes your systemâall apps, programs, user files, user settingsâand presents a fresh installation of Windows?
    13·1 answer
  • The nl2br() function can be used to convert new line entries in a text area into html ________________ tags.
    13·1 answer
  • Anyone down to play gta later i play on ps4?
    15·2 answers
  • Whats the best way to make a video game?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!