GIVEN ; a program in c++ #include <iostream> using namespace std; int main() { d
ID: 3670520 • Letter: G
Question
GIVEN ; a program in c++
#include <iostream>
using namespace std;
int main()
{
double rate, hours;
int id;
char code;
//prompt user for imput
cout << "enter the floating point rate of pay "
<< " and hours worked: ";
cin >> rate >> hours;
cout << " enter the employee's integer id : ";
cin >> id;
cout << " enter the tax code (h,r,l): ";
cin >> code;
cout << rate << endl << hours << endl <<
id << endl << code << endl;
return 0;
QUESTION;
Update the code so that the output is in a more user-friendly format as shown here;
enter the floating point rate of pay and hours worked :10.10
40
enter the employee's integer id:12345
enter the tax code (h,r, or l):r
the hourly rate : 10.1
the hours:40
the employee id:12345
the tax code:r
press any key to continue..............
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
double rate, hours;
int id;
char code;
//prompt user for imput
cout << "enter the floating point rate of pay "<< " and hours worked: ";
cin >> rate >> hours;
cout << " enter the employee's integer id : ";
cin >> id;
cout << " enter the tax code (h,r,l): ";
cin >> code;
cout <<" The hourly rate: "<< rate << endl;
cout<<"The hours "<< hours << endl;
cout<<"The employee id "<<id << endl;
cout<<"The tax code is "<< code << endl;
cout<<"Press any key to contunue....."<<endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.