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 research team is studying parallel computing. They want to run parallel processes without having to use multiple processors. H
valentina_108 [34]
D by using locks okkkkkkkk
6 0
3 years ago
Read 2 more answers
23. ____________ is a slide that is used as the base design theme for other slides.​
MatroZZZ [7]

Hmmmmmmmmm, <u>powerpoint</u>?

5 0
2 years ago
In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
MrMuchimi

Hexadecimal numbers are just a convenient representation of binary data. When entered as text, they consist of ASCII characters 0-9 and a-f. The numbers will then have to be converted to binary. This is accomplished by converting to uppercase, subtracting the ASCII offset (48 for 0-9 or 55 for A-F), so that the result is a number between 0 and 15 (inclusive). This can be stored in computer memory to represent 4 bits.

Hexadecimal numbers represent binary numbers in the following way:

hex | binary

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

a = 1010

b = 1011

c = 1100

d = 1101

e = 1110

f = 1111

As you can see, no other 4 bit combination exists.



5 0
3 years ago
Ninety-two percent of the new information was stored on magnetic media, mostly in _____.
kiruha [24]

Answer:

The answer to the following question is the option "b".

Explanation:

In the computer system, Hard disks stand for the hard disk drive. It is also known as a hard disk. It locates inside the computer case. The hard disk drive is used to store an electromechanical data. That uses magnetic storage device that store and retrieve data. So the answer to this question is hard disks.

5 0
3 years ago
Help please not trying to fail
deff fn [24]

Answer:

B. Everywhere CFCI is not

8 0
3 years ago
Other questions:
  • A layer of control in each communicating device that provides functions such as flow control, error detection, and error control
    13·1 answer
  • A motherboard has four DIMM slots; three slots are gray and the fourth is black. What type of memory is this board designed to u
    6·1 answer
  • Use the RSA cipher with public key n = 713 = 23 · 31 and e = 43. Encode the word "KING" into its numeric equivalent and encrypt
    15·1 answer
  • Which of the following jobs is considered part of the information technology industry?
    15·2 answers
  • What was the technology that defined each of the four generations of computers?
    12·1 answer
  • How do you compare text on different pages of a document?
    14·1 answer
  • JAVA NEED HELP ASAP
    7·1 answer
  • Suppose a byte-addressable computer using set-associative cache has 2 16 bytes of main memory and a cache size of 32 blocks and
    10·1 answer
  • Briefly describe the traditional definition of the digital divide. What is it and who is affected, positively and adversely? How
    15·1 answer
  • A document commonly used in real estate transactions, detailing the fees, commissions, insurance, etc. that must be transacted f
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!