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
Evgen [1.6K]
3 years ago
5

Write a program that determines the value of the coins in a jar and prints the total in dollars and cents. Read integer values t

hat represent the number of quarters, dimes, nickels, and pennies. This program will require user input.
Computers and Technology
1 answer:
Shalnov [3]3 years ago
7 0

Answer:

The programming language is not stated. To answer this question, I'll make use of python programming language.

<em>The following units of conversions is used in this program</em>

<em>1 quarter = $0.25</em>

<em>1 dime = $0.10</em>

<em>1 nickel = $0.05</em>

<em>1 penny = $0.01</em>

<em>$1 = 100 cents</em>

This program makes use of few comment (See explanation for line by line explanation)

Having listed the above, the program is as follows:

#prompt user for inputs

quarters = int(input("Number of Quarters: "))

dimes = int(input("Number of Dimes: "))

nickels = int(input("Number of Nickels: "))

pennies = int(input("Number of Pennies: "))

#Convert coins to dollars

dollar = 0.25 * quarters + 0.10 * dimes + 0.05 * nickels + 0.01 * pennies

print("Dollar Equivalent")

print(str(round(dollar,2))+" dollars")

cent = dollar * 100

print("Cent Equivalent")

print(str(round(cent,2))+" cents")

Explanation:

This first line is a comment

#prompt user for inputs

This line prompts user for value of quarters in the jar

quarters = int(input("Number of Quarters: "))

This line prompts user for value of dimes in the jar

dimes = int(input("Number of Dimes: "))

This line prompts user for value of nickels in the jar

nickels = int(input("Number of Nickels: "))

This line prompts user for value of pennies in the jar

pennies = int(input("Number of Pennies: "))

Using the coin conversion listed in the answer section, the user inputs is converted to dollars in the next line

dollar = 0.25 * quarters + 0.10 * dimes + 0.05 * nickels + 0.01 * pennies

The string "Dollar Equivalent" is printed using the next line

print("Dollar Equivalent")

This line prints the dollar equivalent of the converted coins

print(str(round(dollar,2))+" dollars")

Using the coin conversion listed in the answer section, the user inputs is converted to cents in the next line

cent = dollar * 100

The string "Cent Equivalent" is printed using the next line

print("Cent Equivalent")

This line prints the cent equivalent of the converted coins

print(str(round(cent,2))+" cents")

Please note that the dollar and cent equivalents are rounded to two decimal places. Even though, it's not a requirement of the program, it's a good programming practice

You might be interested in
A(an)_______is built-in preset calculation. <br>formula <br> function <br>equation <br>AutoSum​
Yanka [14]

Answer:

Hello! The answer to your question is function I had the same question and got it right!

Explanation:

Hope this helped:)

3 0
3 years ago
Do you have to be in hard mode in terraria to make the timeless traverler vanity set
BabaBlast [244]
Answer: it can only be crafted in corruption world unless you create an artificial corruption biome.
4 0
3 years ago
Nnbnnb dfhhfhfbhfbhdffd<br> ddbhfbhdhfbhdhf<br> hhffudjbfbjkd<br> dbhdfbhbfhdb
saveliy_v [14]
Tahheuend
Thatgeheh
Thahyateg
Fascinating
:)
6 0
3 years ago
The first time a user launches the PowerPoint program, which view is shown allowing the user to access recent presentations or c
Zielflug [23.3K]

Answer:

Possibly Edit view, might be wrong

Explanation:

3 0
3 years ago
Read 2 more answers
How the python programming interesting for non programmers?
aleksandrvk [35]

Answer:

The python programming language is interesting for non-programmers as it is easy to learn the syntax.  It has extensive libraries that can support every action of the non-programmer and programmer.

Explanation:

Python as a programming language has proved to be the easiest to learn and use.  It is also powerful and versatile, making it the best choice for all beginners and experts.  The readability of the Python language also makes it a great first programming language to learn.  It enables one to think like a programmer and not waste time over any confusing syntax.  Another great advantage possessed by the Python language is that it is easy to download and install for use.

6 0
2 years ago
Other questions:
  • given the numerical value 1010101.11, which of the following number systems is most likely represented.
    11·1 answer
  • What is the Code of Conduct/Ethics for the company/of Department of Defense?
    7·1 answer
  • How does this app work?
    11·2 answers
  • 3. Under the Driver Responsibility Program, you may be assigned a number of points for:
    11·2 answers
  • This morning when Paul turned on his computer at work, it would not boot. Instead, Paul reported that he heard a loud clicking n
    6·1 answer
  • Websites can have good content for a particular set of search phrases, yet rank poorly. Issues that may cause this to occur incl
    9·1 answer
  • What are wizard ranks in brainly​
    13·2 answers
  • Assert statements are a tool programmers employ to help them debug their code more efficiently.
    6·1 answer
  • Which of the following is used to store data in the computer's memory that can be
    7·1 answer
  • What is the purpose of the GETPIVOTDATA function?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!