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
Search engines enable you to
Phoenix [80]

Located web pages related to a specific subject


Please let me know if you have questions !

4 0
3 years ago
Fair use allows individuals to break copyright so long as they ________.
Iteru [2.4K]
Can prove they are not infringing on copyright
4 0
3 years ago
The _______ displays the name of the open file and the program.
Svetlanka [38]
The answer is a. Title Bar

The Title Bar displays the name of the program and the name of the current open file, whether it is just displayed or being edited. It is located at the top of the program window.
3 0
3 years ago
Why wont my account update from Expert to Ace? I have all the points and branliests to be Ace but it wont update
grin007 [14]

Answer:

Maybe you don't have all the points and brainliests needed. Double check and if you actually don't, try to reload your device. If it still isn't working, there is something wrong with your device.

Explanation:

PLEASE MARK ME AS BRAINLIEST I REALLY WANT TO LEVEL UP

8 0
2 years ago
Read 2 more answers
What describes Accenture's approach to automation?
kogti [31]

human center because we describe stuff by what we see and obserevs

4 0
2 years ago
Read 2 more answers
Other questions:
  • Describe in one or more complete sentences how someone starting a computer repair business in a town night gain a competitive ad
    15·1 answer
  • If you press the tab key when you're in in the last cell of a table,
    10·1 answer
  • Use NumPy to recreate your answer to Question 1b. The input parameters will both be python lists, so you will need to convert th
    8·1 answer
  • Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in
    6·1 answer
  • When a computer is booted the checks the computer's components?
    7·1 answer
  • Description A data retrieval tool that finds specified data within a database A collection of records All of the fields for a si
    7·1 answer
  • Richard needs to copy information from another slide presentation that uses a different design template. To ensure that the info
    10·1 answer
  • Which statement assigns the value 140 to the variable streetNumber in Python?
    13·1 answer
  • What is the difference between autofocus and autocomplete
    8·1 answer
  • Read the ages of three people and find the average. Display the result.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!