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
Change the file name for index.html to index.php
Damm [24]

The PHP code is given below:

<h3>PHP code</h3>

if(isset($_REQUEST['login_btn'])){

       $email = filter_var(strtolower($_REQUEST['email']),FILTER_SANITIZE_EMAIL); //strtolower changes email to all lower case

       $password = strip_tags($_REQUEST['password']);

The remaining code is in the file attached.

 

Read more about PHP here:

brainly.com/question/27750672

#SPJ1

Download txt
4 0
1 year ago
In a complex system, many subsystems interact with one another. How do these systems interact in terms of inputs and outputs?
Artemon [7]

Answer:

I think in there transmission you know inputs into ports like for their own

Explanation:

likeslike Spanish and is obviously inputs and outputs their portsinto the portsdifferent ports you know

4 0
3 years ago
10 points!
melisa1 [442]

Advantages;            

Firstly, the internet can let a person to communicate with people in virtually any parts of the world through the internet or e-mail, without having to leave his room. E-mail allowed peoples to communicate with minimum of times. It is now possibles to send a message to any parts of the world through a simple e-mail address and the message is delivered in matter of seconds. Every companies is using e-mail in business. The convenience of e-mail has allowed businesses to expand and communicates with their vendors and customers located all over the world in records times. Personal communication has also become more easier thanks to e-mail. Chat rooms, video conferencing are some of the latest additions in this technology and these have allowed peoples to chat in real time. Besides, there are a lot of messengers services in offering. With the help of such services, it has become very easy to establish a kind of global friendship where you can share your thoughts and explore other cultures. The internet also allows people within an organization to easily communicate and share informations.

Second, information is probably the biggest advantages that internet offers. Internet is a virtual treasures trove of information. Any kinds of information on any topic under the sun is available on the internet. The search engines like Google, Yahoo are at your service through the internet. There is a huge amount of information available on the internet for just about every subjects known to man, ranging from government law and services, trade fairs and conferences, market information, new ideas and technical support, the lists is simply endless. We can uses these search engines, websites dedicated to different subjects and large amount of articles and papers are available for perusal in a matter of a few seconds.

Forums on a number of sites allow peoples to discuss and share their thoughts and informations with others located at different places all over the world. Whether this information is the latest news happenings in the world or information about your favourite celebrity, everything is available at your finger tips. A huge cache of data is available on the internet on every single subjects. With this storehouse of information people can not only increases their knowledge bank but can do so without wasting their time through traditional means such as visiting libraries and conducting exhaustive research. With internet, students can save their times to search for information and using their time to do other works.

This is particularly relevant for students who can use this wealth of information for their school projects and also learn new things about the subjects they are interested in. In fact this internet is for many schools and universities that are now able to assigns projects and work to the students and follows their progress which can be easily posted on the school or university internal websites. Online education has grown at a very fast pace since internet allow the development and uses of innovative tools for imparting education. University students and lecturers can communicate through internet. Besides, some universities are also offerings far distances courses to make study become more inefficient and convenience. Internet become a gateway for those who wants to learn but cannot afford the living fees at foreign countries.

Thirdly, entertainments is another popular reasons why many people prefer to surf the internet. In fact, the internet has becomes quite successful in trapping the multifaceted entertainment industry. Downloading games or just surfing the celebrity websites are some of the uses people have discovered. Even celebrities are using the internet effectively for promotional campaigns. Besides that, there are numerous games that can be downloaded for free. The industry of online gaming has tasted dramatic and phenomenal attentions by game lovers. The internet has also revolutionized the entertainments industry. People nowadays no need to go to a cinema hall to watch your favourite movie. Instead of watching movies at cinema now have companies offering their services where you just can downloads or order your favourite movie and watch it with a fast internet connection. Besides that, you also can download other important software or your favourite music in a matter of few minutes. There are a number of shareware programs that allow you to share and download your favourite music and videos. The internet also allows people from different cultures and background to connect with each other. Internet gaming is a huge business and allow enthusiastic gamers to compete against each other in games even when they are located far apart. Likewise dating has also allowed people to find their prospective soul mates.

4 0
3 years ago
What is the most significant result based on the development of windmills and water wheels?
daser333 [38]
Power both wind mills and water wheels produced power which was used for textile factories ect
6 0
3 years ago
What was the #1 song in 1987 and who was the artist
Veronika [31]
Billboard magazine said it was "Walk Like an Egyptian" by The Bangles.
8 0
3 years ago
Read 2 more answers
Other questions:
  • What does BMP stand for?
    10·2 answers
  • Chris needs to modify the default bullets that are used in a nonnumbered list in word. Which method should he use?
    9·2 answers
  • Write a program in c or c++ to perform different arithmeticoperation using switch statement .the program will take two inputinte
    10·1 answer
  • When planning the structure of a spreadsheet, columns are for _______ items and rows are for _______ items.
    5·2 answers
  • A document format is
    11·2 answers
  • If you want to present slides to fellow students your coworkers which productivity software should you use to create them
    15·2 answers
  • Can anyone help me this is due today :) <br> Thank you so much
    14·2 answers
  • Create a method called randomValues that uses a while loop to generate a random number between 1-25 until the value 10 is genera
    12·1 answer
  • Does anyone know what i did wrong?
    13·1 answer
  • Decimal numbers are based on __________.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!