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
email communication has its own set of etiquette guildelines for users to follow if they want to be effectove communicators. whi
Len [333]
Effective not effectove. These are guidelines:
Be brief.
Have a short opening sentence or paragraph that puts the matter in context.
Use the middle paragraph(s) to cover the matter(s) in hand.
Close with a clear agreement of what will be done, by whom, and by when.
7 0
3 years ago
________ are devices in a computer that are in either the on or off state
Vanyuwa [196]
The appropriate response is Electrical Switches. These are electromechanical gadgets that are utilized as a part of electrical circuits to control, recognize when frameworks are outside their working reaches, flag controllers of the whereabouts of machine individuals and work pieces, give a way to manual control of machine and process capacities, control lighting, et cetera.
6 0
3 years ago
How will wireless information appliances and services affect the business use of the Internet and the Web? Explain.
Paraphin [41]

Answer:

wireless information appliances and services affect the business use of the internet and the web in a positive way. Wireless information appliances and services affect the business use of the web and internet by allowing internet pretty much anywhere. Now days devices like cell phones can access almost everything a regular computer can access. The use of wireless information allows businesses to stay in constant contact with customers, employees, and suppliers.

3 0
2 years ago
A network administrator is implementing a ping from one end of the network to the other, records the average round-trip time and
alexira [117]
May be a Network diagram.
3 0
3 years ago
Given the declaration
STALIN [3.7K]

Answer:

False

Explanation:

There's only one component of the array list which is list[0] which has value 50

7 0
3 years ago
Other questions:
  • __ means having a current knowledge and understanding of computers, mobile devices, the web, and related technologies.
    8·1 answer
  • what has become an established maritime commerce Center and one of the largest cities in the United states ​
    11·1 answer
  • Suppose the information content of a packet is the bit pattern 1110 0110 1001 1101 and an even parity scheme is being used. What
    15·1 answer
  • Describe shortly about the following Linux directories and theirpurpose,1. lib2. etc3. Boot4. Root5. home
    6·1 answer
  • What is an example of a transition effectl
    7·1 answer
  • Witch of the following is a valid why a scientist might a scientific theory
    13·1 answer
  • Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
    7·1 answer
  • In the code snippet below, pick which instructions will have pipeline bubbles between them due to hazards.
    12·1 answer
  • Explain the steps in starting the MS Access from the Start Menu.​
    9·1 answer
  • Which of the following is not a reason to choose a community college?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!