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]
3 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]3 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
Word Bank:
NNADVOKAT [17]

Explanation:

circle with radius and colour red

3 0
3 years ago
[True/False] Mainframes, unlike microcomputers, allow users unlimited and flexible access to computing power.
Lemur [1.5K]

Answer:

The given statement is "False".

Explanation:

Mainframes computer are also known big iron computer basically Mainframe computer is used by the big organization when the organization needs to work in the high-level project. The mainframe has big data processing. It is highly used in critical applications such as ERP(Enterprise resource planning).

A mainframe computer is not a flexible computer also they are not potable .microcomputers, are more flexible computers we can easily work on the microcomputers.

So the given statement is False.

8 0
3 years ago
The following numbers are sorted in which way: 10,20,30,40?
Bas_tet [7]

The numbers are sorted by tens

8 0
3 years ago
Read 2 more answers
Noah is saving his Excel spreadsheet as shown.
AnnZ [28]

Answer:

DiverseNames.xls

Explanation:

3 0
3 years ago
A thermogram taken outside a house shows high amounts of thermal energy around the windows but not around the roof. which conclu
mestny [16]

The conclusion sustains the thermogram will be that the windows are not energy efficient, but the roof stands energy efficient.

<h3>What is Thermography?</h3>

Thermography exists a noninvasive method that employs an infrared camera to develop pictures that depict patterns of heat and blood flow on or around the body's surface. A thermogram taken outside a house shows high quantities of thermal energy around the windows but not around the roof. The conclusion that supports the thermogram will be that the windows are not energy efficient, but the roof exists energy efficient.

Thermal energy (also named heat energy) is produced when a rise in temperature pushes atoms and molecules to move faster and collide with each other. The energy that reaches the temperature of the heated substance is named thermal energy. The term "thermal energy" exists utilized loosely in various contexts in physics and engineering. It can guide several different well-defined physical concepts.

To learn more about Thermography refer to:

brainly.com/question/1500896

#SPJ4

The complete question is,

A thermogram taken outside a house shows high amounts of thermal energy around the windows but not around the roof.

Which conclusion supports the thermogram?

The windows and the roof are energy efficient.

The windows and the roof are not energy efficient.

The windows are not energy efficient, but the roof is energy efficient.

The windows are energy efficient, but the roof is not energy efficient.

4 0
1 year ago
Other questions:
  • Which of these is not a combination of a keyboard and percussion musical instrument?
    13·1 answer
  • How to copy music from windows media player to pc?
    13·1 answer
  • Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page? A. B. C. D.
    8·1 answer
  • You are having trouble closing a program. You have tried to hit the Close button, the keyboard shortcut to close the program, an
    6·1 answer
  • create a boolean variable called sucess that will be true if a number is between -10 and 10 inclusively python
    11·1 answer
  • Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the ga
    12·2 answers
  • User Interface Design ensures that the interface has elements that are easy to ________________. (Choose all that apply)
    10·2 answers
  • Python
    6·1 answer
  • Read two numbers from user input. Then, print the sum of those numbers. Hint - Copy/paste the following code, then just type cod
    9·1 answer
  • Please answer this question​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!