#include<iostream> usingnamespace std ; intmain() { declare hours_worked as anin
ID: 3609472 • Letter: #
Question
#include<iostream>
usingnamespace std ;
intmain()
{
declare hours_worked as aninteger ;//No. of hrs worked during week
declare pay_rateas a float ; //Pay rate:dollars per hour
declare wages asa float ; //Weeklywages
// read in thehours worked
cout <<endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin >> hours_worked ;
// read in thepay rate
cout <<"Hourly pay rate (specify two digits "
<< "after the decimal point) = ";
cin >> pay_rate ;
// computewages
writeassignment statement to compute wages ;
// display theresult
cout <<endl ;
cout << "The weekly wages are: $" << wages <<endl ;
return (0); //terminate with success
}
Explanation / Answer
using namespace std;
int main()
{
//declare hours_worked asan integer ;//No. of hrs worked during week
//declare pay_rate as a float ; //Pay rate: dollars per hour
//declare wages as a float; //Weeklywages
// read in the hoursworked
int hours_worked;
float pay_rate,wages;
cout << endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin >> hours_worked ;
// read in the payrate
cout << "Hourly payrate (specify two digits "
<< "after the decimal point) = ";
cin >> pay_rate ;
// computewages
//write assignmentstatement to compute wages ;
wages = pay_rate * hours_worked;
// display theresult
cout << endl ;
cout << "The weekly wages are: $" << wages <<endl ;
system("pause");
return (0); // terminate with success
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.