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
Can someone please explain binary addition to me? i have a test tomorrow yikes
umka2103 [35]

Answer:

its easy

Explanation:

there are are 5 main rules

in binary there are 2 number 0 and 1

0 + 0 = 0

0 + 1 = 1

1+0=1

1+1=0 carry 1

e . g

1 1 1

1 0 1 0 1 0

+ 1 1 0 0 1 0

-------------------------

1 1 1 1 1 0 0

*in bold are the ones that you need to carry.

in decimal there are 10 possible numbers 0- 9

when you do 1 + 9 it becomes 10, this can be done easily, however if you do 1 + 9 in a table like above, you will get 0 for the first column and you will carry 1 to the next column .

in binary is the same idea but using on 2 numbers 1 and 0

e.g

1

1

+ 9

----------

1 0

*in bold are the ones that you need to carry.

hope it helps and good luck in your exam.

3 0
2 years ago
Julie: 3: 36, 6:72, 9:108....tell me the next 3 ratios * math*
svlad2 [7]

Answer:

12:144, 15:180,

Explanation:

8 0
3 years ago
Write an expression that will cause "greater or equal to -10" to print if the value of userNum is greater than or equal to -10.
Lilit [14]

Answer:

Expression for the above problem in python language:

userNum=int(input("Enter the value of user_Num")) #it is used to take input.

if(userNum>(-10)): #if statement

   print("The value of the userNum is greator")

elif(userNum==(-10)): #elif statement

   print("The value of the userNum is equal to -10")

else: #else statement.

   print("The value of the userNum is small")

Output:

  • If the user input is (-10), it will print equal.
  • If the user input 10, it will print greator message.

Explanation:

  • The above program or expression is in python language, where the first line is used to render a message to the user take the input and store it into a userNUM variable.
  • Then the second line is used to check the user num value to be greater with the help of if statement.
  • Then the third statement is used to check the user num value to be equal with the help of elif statement.
  • Then the else statement will execute when the if and the elif statement will not true.
6 0
3 years ago
What is an icon or animation used to represent aparticipant in an internet chat referred to as?
Veronika [31]
Emoji is an icon or animation used to represent a participant in an internet chat.
8 0
3 years ago
Which of the following goals states a quantifiable outcome of a project?
Ugo [173]

Answer:

An increase in revenue

Explanation:

We cannot predict how much revenue growth we are going to generate, and at what time. And hence, 2 and 3 are not an option here. Also, a TV science show has nothing to do with the quantifiable outcome of a project. And what is true is certainly that there is going to be an increase in revenue, which can certainly predict if we feel work was good and ended with good results. And hence the above option is the correct option for this question.

6 0
3 years ago
Other questions:
  • Why might your digital footprint be important when you are applying for collage
    13·1 answer
  • A technician is talking to end users about the specifications for an upgraded application server. The users of the application r
    11·1 answer
  • John works in the Sales and Marketing group. Why does his group need to interact with operations management to plan the launch o
    12·1 answer
  • Eliza needs to share contact information with another user, but she wants to include only certain information in the contact. Wh
    9·2 answers
  • A fast way to add up a column of numbers is to click in the cell below the numbers and then: Click Subtotals on the Data menu. V
    6·2 answers
  • You cannot be everywhere at once, but your freedom allows you to
    5·1 answer
  • Rafi is developing an application to send urgent information about global health crises over the Internet to hospitals. He is wo
    6·1 answer
  • What is cyber security ???​
    8·1 answer
  • The files in James's computer were found spreading within the device without any human action. As an engineer, you were requeste
    11·1 answer
  • What is the advantage of learning through story compared to learning through personal experience?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!