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]
3 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:
NeTakaya3 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
Create a program in c/c++ which accepts user input of a decimal number in the range of 1 -100. Each binary bit of this number wi
kirill115 [55]

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

void switch_fun(int input)

{

//array to store binary of input number

   int bin[7];

   // convert the number into binary

   for(int i=0; input>0; i++)

       {

           bin[i]=input%2;

           input= input/2;

       }

   // print the switch number and their status

   cout<<"Switch number:\t 1\t 2\t 3\t 4\t 5\t 6\t 7 \n";

   cout<<"status:      ";

   for(int j=6;j>=0;j--)

   {

   // if bit is 1 print "ON" else print "OFF"

       if(bin[j]==1)

           cout<<"\t ON";

       else

           cout<<"\t OFF";

   }

}

int main()

{

   int n;

   cout<<"enter the number between 1-100 only:");

   // read a number in decimal

   cin>>n

   // validate the input

   while(n<1 ||n>100)

   {

     cout<<"wrong input!! Input must be in between 1-100:"<<endl;

     cout<<"enter the number again :";

     cin>>n;

   }

// call the function with input parameter

  switch_fun(n);

return 0;

}

Explanation:

Read a decimal number from user. If the number is not between 1 to 100 the it will again ask user to enter the number until the input is in between 1-100.Then it will call the fun() with parameter n. First it will convert the decimal to binary array of size 7.Then print the status of switch.If bit is 1 then print "ON" else it will print "OFF".

Output:

enter the number between 1-100 only:-5

wrong input!! Input must be in between 1-100:

enter the number again :125

wrong input!! Input must be in between 1-100:

enter the number again :45

Switch number:   1       2       3       4       5       6       7

Status:          OFF     ON      OFF     ON      ON      OFF     ON

8 0
3 years ago
You receive an e-mail that seems to come from your bank. Clicking on a link in the message takes you to a website that seems to
lions [1.4K]

Answer:

A Phishing Attack

Explanation:

The term "phishing" comes from the combination of the English term "fishing", which means to fish, with the term "phreak", often used to name the first telephony hackers.

It is a type of scam that uses technological mechanisms, usually based on messages, to persuade and deceive people, with a specific objective, which varies from attack to attack.

For example, sending you an email message with a link like a popular social media platform which is meant to trick you into submitting your login details thereby hacking into your account from the hacker's remote location.

3 0
3 years ago
Read 2 more answers
A user can set the security and privacy settings on what is displayed in the message bar from the ________ within the options me
djverab [1.8K]
Depends on the Operating System
6 0
3 years ago
Consider the practice of outsourcing programmers, a common practice in many U.S. businesses. Think about how this practice is us
GuDViN [60]

The practice of outsourcing programmers is known to be the act of  sharing or delegating as well as handing over control of programming and its associated tasks to any form of  external service provider that is said to be very good in that field and has the power and capabilities to handle the technical and operational areas of a programming project.

<h3>What is outsourcing and why is it always practiced?</h3>

Outsourcing is known to  be a kind of a business practice that entails the act of hiring a party that is known to be outside a company to carry out services or make goods that are said to be traditionally carried out in-house.

Note that The practice of outsourcing programmers is known to be the act of  sharing or delegating as well as handing over control of programming and its associated tasks to any form of  external service provider that is said to be very good in that field and has the power and capabilities to handle the technical and operational areas of a programming project.

Learn more about outsourcing  from

brainly.com/question/12101789

#SPJ1

5 0
2 years ago
If you answer I will mark brainliest!!! I want to be able to see two websites on my screen at the same time, how do I do that on
aleksandrvk [35]
Click chrome with 2 fingers on your mousepad and click new window, you can have 2 websites open at once this way
8 0
3 years ago
Other questions:
  • The control programs managing computer hardware and software perform the _________ function to control and prioritize tasks perf
    8·1 answer
  • Modify the program so that it can do any prescribed number of multiplication operations (at least up to 25 pairs). The program s
    9·1 answer
  • Two Smallest (20 points). Write a program TwoSmallest.java that takes a set of double command-line arguments and prints the smal
    7·1 answer
  • ¿Qué herramienta web es google drive?
    12·2 answers
  • The __________ operator increases the value of the variable by 1 after the original value is used in the expression in which the
    7·1 answer
  • HURRY- I’ll give 15 points and brainliest answer!!
    10·2 answers
  • Match the index with the value
    14·1 answer
  • PLZ PLZ PLZ PLZ HELP I ONLY HAVE 5 MINUTES IT SAYS THE SUBJECT IS COMPUTERS AND TECHNOLOGY BUT ITS ACTUALLY MEDIA LIT
    5·1 answer
  • The process of identifying and eliminating bugs in a software program is most generally called reproducing the problem. diagnosi
    6·1 answer
  • Microsoft Office PowerPoint 2016 enables you to create robust multimedia _______.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!