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
13. You're doing research for a paper. When would you use an indirect citation?
Whitepunk [10]

Answer:

D

Explanation:

d is the answer

5 0
2 years ago
Clickstream tracking tools collect data on customer activities at web sites (true/false)?
Galina-37 [17]

Clickstream tracking tools collect data on customer activities at websites- true.

<h3>what is the website?</h3>
  • A website, often known as a website, is a collection of web pages and associated material that is published on at least one web server and given a shared domain name.
  • The World Wide Web is the aggregate name for all publicly accessible websites.
  • A company's internal website for its workers is an example of a private website that can only be viewed via a private network.
  • Most websites focus on a single subject or objective, including news, education, business, entertainment, or social networking.
  • The navigation of the website, which frequently begins with a home page, is aided by hyperlinks between web pages.

To learn more about website, refer to the following link:

brainly.com/question/9060926

#SPJ4

3 0
1 year ago
What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is
BigorU [14]

Answer:

Option D is correct.

Explanation:

Option D is correct because  when the condition  if (list[j] < temp) is tested it only gets true when element in list[] array at <em>jth</em> position is less than the value in <em>temp</em> and after that it increments the value of c by this statement: c++ and so c is incremented from 0 to as much times as much elements in list[] are lesser than temp.

6 0
3 years ago
Read 2 more answers
Write a user-defined function that calculates the GPA. For the function name and arguments, use the following: The input argumen
QveST [7]

Answer:

#include <iostream>

#include <vector>

using namespace std;

void calGPA();

vector<int> g;

vector<int> h;

int main(){

   char pushMore = 'y';

   int fg, fh;

   for (;;){

       if (pushMore == 'n'){

           break;

       } else{

           cout<< "Enter integer for grade: ";

           cin>> fg;

           cout<< "Enter integer for credit hours: ";

           cin>> fh;

           g.push_back(fg);

           h.push_back(fh);

           cout<< "Do you want to add more grade and credit hours? y/n: ";

           cin>> pushMore;

       }

   }

   calGPA();

}

void calGPA(){

   double total = 0, GPA;

   for (int i = 0; i < g.size(); ++i) {

        total +=  g.at(i) * h.at(i) ;

   }

   cout<< "The GPA is : "<< total/g.size();

}

Explanation:

The C++ source code above defines two vectors 'g' and 'h'. The latter holds the grades of a student while the former holds the credit hours for the subject taken. The void 'calGPA' function calculates and prints the student's GPA.

7 0
2 years ago
Which of these situations would benefit from the AutoRecover feature? Check all that apply.
UNO [17]

Answer: Your friend wants you to email her.

Explanation:

3 0
2 years ago
Read 2 more answers
Other questions:
  • Your website is currently at position 5 in organic search. On a monthly basis you currently get on average 5,432 clicks and 32 c
    7·1 answer
  • Using information from the lesson, explain how new technologies change your experience as a consumer.
    5·2 answers
  • How many ways can you add an image into google slides?
    8·1 answer
  • To ease giving access to network resources for employees, you decide there must be an easier way than granting users individual
    9·1 answer
  • CottonPlus, a sportswear company, is releasing a new casual sportswear line. The company approaches a basketball star to endorse
    14·1 answer
  • How could you insert a new row between rows 20 and 21?
    7·2 answers
  • _KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
    12·1 answer
  • Hi, I just have a few questions from my digital tech assignment.
    14·2 answers
  • What color line appears under a word that is spelled incorrectly in power point
    11·2 answers
  • In saving a Visual Basic project properly , which of the following: two components part are involved ?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!