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
Effectus [21]
3 years ago
13

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

r line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. The input should be an integer, with the unit as "cents". For example, the input of 126 refers to 126 cents. 1 Dollar = 100 cents 1 Quarter = 25 cents 1 Dime = 10 cents 1 Nickel = 5 cents 1 Penny = 1 cent Ex: If the input is:
Computers and Technology
1 answer:
riadik2000 [5.3K]3 years ago
4 0

Answer:

In Python:

cents = int(input("Cents: "))

dollars = int(cents/100)

quarters = int((cents - 100*dollars)/25)

dimes = int((cents - 100*dollars- 25*quarters)/10)

nickels = int((cents - 100*dollars- 25*quarters-10*dimes)/5)

pennies = cents - 100*dollars- 25*quarters-10*dimes-5*nickels

if not(dollars == 0):

   if dollars > 1:

       print(str(dollars)+" dollars")

   else:

       print(str(dollars)+" dollar")

if not(quarters == 0):

   if quarters > 1:

       print(str(quarters)+" quarters")

   else:

       print(str(quarters)+" quarter")

if not(dimes == 0):

   if dimes > 1:

       print(str(dimes)+" dimes")

   else:

       print(str(dimes)+" dime")

if not(nickels == 0):

   if nickels > 1:

       print(str(nickels)+" nickels")

   else:

       print(str(nickels)+" nickel")

if not(pennies == 0):

   if pennies > 1:

       print(str(pennies)+" pennies")

   else:

       print(str(pennies)+" penny")

   

Explanation:

A prompt to input amount in cents

cents = int(input("Cents: "))

Convert cents to dollars

dollars = int(cents/100)

Convert the remaining cents to quarters

quarters = int((cents - 100*dollars)/25)

Convert the remaining cents to dimes

dimes = int((cents - 100*dollars- 25*quarters)/10)

Convert the remaining cents to nickels

nickels = int((cents - 100*dollars- 25*quarters-10*dimes)/5)

Convert the remaining cents to pennies

pennies = cents - 100*dollars- 25*quarters-10*dimes-5*nickels

This checks if dollars is not 0

<em>if not(dollars == 0):</em>

If greater than 1, it prints dollars (plural)

<em>    if dollars > 1:</em>

<em>        print(str(dollars)+" dollars")</em>

Otherwise, prints dollar (singular)

<em>    else:</em>

<em>        print(str(dollars)+" dollar")</em>

This checks if quarters is not 0

<em>if not(quarters == 0):</em>

If greater than 1, it prints quarters (plural)

<em>    if quarters > 1:</em>

<em>        print(str(quarters)+" quarters")</em>

Otherwise, prints quarter (singular)

<em>    else:</em>

<em>        print(str(quarters)+" quarter")</em>

This checks if dimes is not 0

<em>if not(dimes == 0):</em>

If greater than 1, it prints dimes (plural)

<em>    if dimes > 1:</em>

<em>        print(str(dimes)+" dimes")</em>

Otherwise, prints dime (singular)

<em>    else:</em>

<em>        print(str(dimes)+" dime")</em>

This checks if nickels is not 0

<em>if not(nickels == 0):</em>

If greater than 1, it prints nickels (plural)

<em>    if nickels > 1:</em>

<em>        print(str(nickels)+" nickels")</em>

Otherwise, prints nickel (singular)

<em>    else:</em>

<em>        print(str(nickels)+" nickel")</em>

This checks if pennies is not 0

<em>if not(pennies == 0):</em>

If greater than 1, it prints pennies (plural)

<em>    if pennies > 1:</em>

<em>        print(str(pennies)+" pennies")</em>

Otherwise, prints penny (singular)

<em>    else:</em>

<em>        print(str(pennies)+" penny")</em>

<em>    </em>

You might be interested in
Which best describes rfid technology?
Liula [17]
RFID stands for <span>Radio-Frequency Identification. RFID is the use of radio waves to reach and capture data. The RFID chip can hold about 2,000 bytes of info.
</span><span>The RFID device serves the same purpose as a bar code or a magnetic strip on the back of a credit card or ATM card; it provides a unique identifier for that object. And, just as a bar code or magnetic strip must be scanned to get the information, the RFID device must be scanned to retrieve the identifying information.</span>
4 0
3 years ago
If you are trying to create a web page for your band and having difficulty creating links to other groups on your page, what is
Georgia [21]

Answer: Malfunctioning of your hypertext program or malfunctions in your hypertext program.

Explanation: Hypertext is text that contains links to other texts. The HyperMedia is a collective term which can include graphics, video, sounds and texts, hence Hypertext.

The Hypertext also be said to be a special type if database system in which objects like Text, pictures, music, programs etc can be linked to each other creatively such that When you select an object, you can see all the other objects that are linked to it and you can move from one object to another regardless of if they have different forms or not. It was invented by Ted Nelson in the 1960s.

According to the question, when you are trying to create a web page for your band and creating links to other groups on your page, you are probably using the hypertext and if you are having problems doing this, then your hypertext linking is malfunctioning.

7 0
3 years ago
Your wireless network consists of multiple 802.11n access points that are configured as follows: SSID (hidden): CorpNet Security
nasty-shy [4]

Answer:

double the bandwidth assigned per channel to 40 MHz

Explanation:

The best way of doing this would be to double the bandwidth assigned per channel to 40 MHz. This will make sure that the capacity is more than sufficient. This is simply because the bandwidth of a channel represents how much information can pass through the channel at any given second, the larger the channel, the more information/data that can pass at the same time. Therefore, if 20 MHz is enough for the network, then doubling this bandwidth channel size would be more than sufficient capacity for the network to handle all of the data.

6 0
3 years ago
Create a set of functions that compute the mean, median, and mode of a set of
zepelin [54]

Refer to the attachment.

Language used=Python

5 0
3 years ago
Read 2 more answers
Explain how can you protect your computer from malware
rosijanka [135]
Trend micro security for your Mac or pc or trend micro mobil security for your android or iOS Mobil device?

Hope this helps!
6 0
4 years ago
Read 2 more answers
Other questions:
  • What tool listed below will be the most useful for developing presentation content?
    10·2 answers
  • Which of the following is not an example of technological progress? A: new scientific knowledge that has practical applications
    12·2 answers
  • Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than
    14·2 answers
  • Write a program that performs the following tasks: Display a friendly greeting to the user Prompt the user for the value to conv
    13·1 answer
  • Which term describes the distance from one point on a wave to the same point on the next wave?
    13·2 answers
  • Write down the bit pattern in the fraction of value 1/3 assuming a floating point format that uses Binary Coded Decimal (base 10
    10·1 answer
  • Once the CPU has fetched the data requested, what are the next steps in the process?
    15·1 answer
  • Rosa is building a website for a multimedia company. She wants to add a drop-down menu functionality to the website's main page.
    12·1 answer
  • Write a description of the photograph to someone who cannot see the photograph. Be sure to include the title of the photograph a
    5·1 answer
  • How to mark a discussion as read on canvas dashboard.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!