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