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
Panes created using the vertical split bar scroll together horizontally. true or false.
Nataly_w [17]
I think the statement given above is false. Panes created using the vertical split bar do not scroll together horizontally. <span>The two </span>panes scroll together vertically, but scroll<span> independently </span>horizontally<span>. Hope this answers the question. Have a nice day.</span>
4 0
2 years ago
What does the Autosum feature on excel do?
BabaBlast [244]
The answer is 1. Pressing the Autosum button highlights the ten cells above it so that you can easily add things together. Hope this helps!
8 0
3 years ago
The management of Ventura Inc. approves the purchase of a few computers for the sales team. The management wants only the most b
BaLLatris [955]

Answer:

Ventura Inc requires only System software's

Explanation:

The system software has three major functions which are:

1. File and disk management: this involve managing of files in the system, when user want to save, move, copy, delete and rename files, The system software will handle those task

2. Allocating system resources: The system resources such as time, memory, data input and output are  allocated by the system software. The main memory is managed by the system software to avoid conflict among various task.

3. Monitoring system activities:  The system security and system performance is also monitored by the system software.

The first two functionalities are the requirement of ventura inc  

8 0
3 years ago
George enters the types of gases and the amount of gases emitted in two columns of an Excel sheet. Based on this data he creates
Alex777 [14]

Answer:

data source

Explanation:

The main aim of a data source is for the gathering of all necessary information that is needed to access a data. Since he has used the information to create a pie chart, this means that some data were used for the creation of this pie chart. Hence the information used for the creation of the pie chart is the data source for the information illustrated on the pie chart.

3 0
3 years ago
What is technology and how does it work?
Yuki888 [10]
Technology is what we use today to access internet and social media!!!
8 0
3 years ago
Other questions:
  • Websites using www showed up on the internet for the first time in -992
    9·1 answer
  • What is wearable technology? Provide at least one example
    13·2 answers
  • The color band that represents tolerance on a resistor is the?
    11·1 answer
  • Ebba received a message from one of her tech support employees. In violation of company policy, a user had downloaded a free pro
    14·1 answer
  • Question 4: What will be the output of the code? Show a complete analysis.
    6·1 answer
  • Once secured a wheelchair may move up to 6 inches in any direction
    6·1 answer
  • Anybody know this question???
    6·1 answer
  • What is the phase of a waveform ?
    15·1 answer
  • Even though jdoe and jrock have the same password (i.e., hacker), their password hashes in the /etc/shadow file are different. W
    15·1 answer
  • Write any two disadvantage of First generations computers​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!