Answer to Question #260770 in C++ for binno

Question #260770

1.     Write C++ statements that prompt the user to enter a person’s last name and then store the last name into the variable name.



1
Expert's answer
2021-11-05T07:25:24-0400
#include <iostream>
#include <string>
	
using namespace std;
	
int main()
{
  int const SECRET = 11;
  double const RATE = 12.50;
  int num1, num2, newNum;
  string name;
  double hoursWorked, wages;

  cout << "Please input 2 numbers: ";
  cin >> num1 >> num2;
  cout << "The value of num1 = " << num1 << " and the value of num2 = " << num2 << endl;

  newNum = num1 * 2 + num2;

  cout << "newNum = " << newNum << endl;

  newNum += SECRET;

  cout << "newNum now = " << newNum << endl;

  cout << "Please enter your surname: ";
  cin >> name;
  cout << "Please enter the number of hours worked (0 - 70): ";
  cin >> hoursWorked;

  wages = hoursWorked * RATE;

  cout << "Name: " << name << endl;
  cout << "Pay Rate: $" << RATE << endl;
  cout << "Hours Worked: " << hoursWorked << endl;
  cout << "Salary: $" << wages << endl;

  return 0;
}

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