Answer to Question #260761 in C++ for vinno

Question #260761

1.     Write C++ statements that produce the following output:

Name:                                            //output the value of the variable name

Pay Rate: $                                   //output the value of the variable rate

Hours Worked:                            //output the value of the variable

                                                      //hoursWorked

Salary: $                                       //output the value of the variable wages

For example, if the value of name is "Rainbow" and hoursWorked is

45.50, then the output is:

Name: Rainbow

Pay Rate: $12.50

Hours Worked: 45.50

Salary: $568.75


1
Expert's answer
2021-11-03T17:47:32-0400
#include<iostream>
using namespace std;

int main()
{
	string name;
	double rate, hoursWorked, wages;
	cout<<"Please, enter the name of the worker: ";
	cin>>name;
	cout<<"Please, enter pay rate for the worker: ";
	cin>>rate;
	cout<<"Please, enter hours worked by worker: ";
	cin>>hoursWorked;
	wages=rate*hoursWorked;
	cout<<"\nName: "<<name
		<<"\nPay Rate: $"<<rate
		<<"\nHours Worked: "<<hoursWorked
		<<"\nSalary: $"<<wages;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS