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
A newspaper publishes a negative editorial on how local politicians are dragging their feet in building a new bridge. Select the
jeka57 [31]
Your answer would be
A. The editorial is data.
I just took this test :)
6 0
3 years ago
Read 2 more answers
Corinne would like to click on the link at the bottom of a Web page but she only sees the top portion of the page. She should __
IgorLugansk [536]
Corinne should scroll down to the bottom of the page to where she can see the link
7 0
3 years ago
Read 2 more answers
Which formula is a simple formula?<br> O =E10/5+1<br> 0 -5+A1*B1<br> O =C3+10-E3<br> 0 =10-(A3-D13)
steposvetlana [31]

Answer:

O =C3+10-E3

Explanation:

Only addition and subtraction :D

8 0
2 years ago
Application software helps run the computer and coordinates instructions with the hardware. select one:
Natalija [7]
The computer technology that allows us to develop three-dimensional virtual environments (VEs) consists of both hardware and software. The current popular, technical, and scientific interest in VEs is inspired, in large part, by the advent and availability of increasingly powerful and affordable visually oriented, interactive, graphical display systems and techniques. Graphical image generation and display capabilities that were not previously widely available are now found on the desktops of many professionals and are finding their way into the home. The greater affordability and availability of these systems, coupled with more capable, single-person-oriented viewing and control devices (e.g., head-mounted displays and hand-controllers) and an increased orientation toward real-time interaction, have made these systems both more capable of being individualized and more appealing to individuals

4 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Tom [10]

Answer:

navigate keys

Explanation:

the up and down keys are to scroll through documents and pages.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Your brother is a video producer and is looking to buy some sort of new computing device. he needs a lot of memory and processin
    11·1 answer
  • To delete a database object, right-click the object in the Navigation Pane and then click ____ on the shortcut menu.
    15·1 answer
  • Una pregunta cuales son los ataques de Sindel que por favor y me lo diga gracias
    11·1 answer
  • Types of operating systems
    5·2 answers
  • Which of the following is not an example of a technological aid?
    11·1 answer
  • How to stay organized in an online school?
    7·1 answer
  • keeping in mind the role in order of precedence plays in equations, what would excel display as the result of the following equa
    14·1 answer
  • Which part of a touchscreen responds to pressure applied to its surface?
    6·1 answer
  • Katy and her associates are approached by an aged tai chi expert to create a website for him. From her participation in an onlin
    9·1 answer
  • How many bits would be needed to count all of the students in class today? There are 40 students.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!