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
vichka [17]
2 years ago
12

Write a program that gets three input characters which are user's initials and displays them in a welcoming message. Then gets i

nput of the quantities of each of the following coins, in the respective order, quarters, dimes, nickels, and pennies.
Computes the total value of the coins, and then displays the value.
Enter the initials with no space, e.g. JTK.
Here are sample runs (blue user input):
Test Run 1
Enter your initials, first, middle and last: JTK Hello J.T.K., let's see what your coins are worth.
Enter number of quarters: 4
Enter number of dimes: 0
Enter number of nickels: 0
Enter number of pennies: 0
Number of quarters is 4.
Number of dimes is 0.
Number of nickels is 0.
Number of pennies is 0.
Your coins are worth 1 dollars and 0 cents.
Test Run 2 Enter your initials, first, middle and last: RHT
Hello R.H.T., let's see what your coins are worth.
Enter number of quarters: 0
Enter number of dimes: 10
Enter number of nickels: 0
Enter number of pennies: 0
Number of quarters is 0.
Number of dimes is 10.
Number of nickels is 0.
Number of pennies is 0.
Your coins are worth 1 dollars and 0 cents.
Computers and Technology
1 answer:
NeTakaya2 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int main()

{

// variable declaration

string initials;

int quarters;

int dimes;

int nickels;

int pennies;

float total;

int dollars;

int cents;

 

 

//initials request

std::cout<<"Enter your initials, first, middle and last: "; std::cin>>initials;

//welcome message

std::cout<<"\nHello "<<initials<<"., let's see what your coins are worth."<<::std::endl;

 

//coins request and display

std::cout<<"\nEnter number of quarters: "; std::cin>>quarters;

std::cout<<"\nEnter number of dimes: "; std::cin>>dimes;

std::cout<<"\nEnter number of nickels: "; std::cin>>nickels;

std::cout<<"\nEnter number of pennies: "; std::cin>>pennies;

 

std::cout<<"\n\nNumber of quarters is "<<quarters;

std::cout<<"\nNumber of dimes is "<<dimes;

std::cout<<"\nNumber of nickels is "<<nickels;

std::cout<<"\nNumber of pennies is "<<pennies;

//total value calculation

total = quarters*0.25+dimes*0.1+nickels*0.05+pennies*0.01;

dollars = (int) total;

cents = (total-dollars)*100;

 

std::cout<<"\n\nYour coins are worth "<<dollars<<" dollars and "<<cents<<" cents."<<::std::endl;

 

return 0;

}

Explanation:

Code is written in C++ language.

  • First we declare the <em>variables </em>to be used for user input and calculations.
  • Then we show a text on screen requesting the user to input his/her initials, and displaying a <em>welcome message</em>.
  • The third section successively request the user to input the number of quarters, dimes, nickels and pennies to count.
  • Finally the program calculates the total value, by giving each type of coin its corresponding value (0.25 for quarters, 0.1 for dimes, 0.05 for nickels and 0.01 for pennies) and multiplying for the number of each coin.
  • To split the total value into dollars and cents, the program takes the total variable (of type float) and stores it into the dollars variable (of type int) since int does not store decimals, it only stores the integer part.
  • Once the dollar value is obtained, it is subtracted from the total value, leaving only the cents part.

   

You might be interested in
Which of the following statements is true?
Ainat [17]

Answer:

ii,iii,iv

Explanation:

####

4 0
3 years ago
Which Python expression results in 49?<br><br> 7 * 2<br><br> 7^2<br><br> 7 // 2<br><br> 7 ** 2
Juliette [100K]

Answer:

7^2

Explanation:

7^2 is the same as 7*7

7 0
3 years ago
Read 2 more answers
Which of these is not a combination of a keyboard and percussion musical instrument?
Sergio [31]

Answer:

The Harmonium is not a combination of a key board and percussion musical instrument.

Explanation:

The Harmonium is not a combination of a key board and percussion musical instrument.

A harmonium, also called a "melodeon", "reed organ" or "pump organ", is a keyboard instrument that is a lot like an organ. It makes sound by blowing air through reeds, which are tuned to different pitches to make musical notes.

3 0
3 years ago
A case competitions database:You work for a firm that has decided to sponsor case competitions between teams of college business
Strike441 [17]

Answer:

We will ned (4) four tables.

Explanation:

For the given scenario we will have to build a relational database. The database will have four tables i.e. Competation, Collage, Team and student.

For each table the database fields are mention below. Note that foreign keys are mentioned in itallic.

Competition:

Competition_ID, Competition_Name, Competition_Data, Competition_Name _of_Branch, <em>College_ID</em>

<em />

Collage:

Collage_ID, Collage_Name, Collage_Contact, Collage_address

Team:

Name, Color, <em>Team_ID, College_ID, Competition_ID</em>

<em />

College:

Student_ID, First_Name, Last_Name, Date_of_Birth, Major, Expected_Gradiuation_Date, <em>Collage_ID, Team_ID, Competation_ID</em>

3 0
3 years ago
Which tasks can Kim complete using the Customize Ribbon dialog box? Check all that apply.
exis [7]

Answer:

Its A, B, C, and F

Explanation:

On edg

5 0
3 years ago
Other questions:
  • What would be the desired output of a home security system?
    6·1 answer
  • _____ is two or more connected computers.
    8·1 answer
  • Which occupation requires certification by the state?
    15·2 answers
  • What is output by the following C# code segment?int temp;temp = 180;while ( temp != 80 ) {if ( temp &gt; 90 ) {Console.Write( "T
    7·1 answer
  • There are varying definitions for the term "dumb terminal," but it often refers to the fact that the terminal has
    13·1 answer
  • Wyatt has a database to keep track of his enormous collection of videos. How can Wyatt find the details for the game Lost on Mar
    11·2 answers
  • Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
    15·2 answers
  • Which is a concept of the CIA of Computer Security
    7·1 answer
  • Which option is an example of an algorithm that is used in daily life?
    8·1 answer
  • During the maintenance phase of the sdlc, the team must _____ if a system's objectives are not being met
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!