It contains the c wages program using a repeat loop in


It contains the C++ wages program using a repeat loop in order to enable the user to compute several wages. The loop ends when the user enters -1 for either the hours_worked or the pay_rate. C++ uses the "do" keyword instead of "repeat".

/* Program to compute the weekly wages repeatedly */
/* */
/* Inputs: (keyboard) */
/* 1. No. of hours worked during a week (integer) */
/* 2. Pay rate (dollars per week) (float) */
/* */
/* Output: */
/* weekly wages displayed on screen as float */
/* */
/* Algorithm: wages = hours worked * rate of pay */
/* */
/****************************************************/

#include

using namespace std;

int main()
{
int hours_worked;
float pay_rate;
float wages;

do //here starts the repeat loop
{
//read in the hours worked
cout << endl ;
cout << "Number of hours worked during"
<< " the week (integer) = " ;
cin>> hours_worked;

// read in the pay rate
cout << "Weekly pay rate (specify two digits "
<< "after the decimal point) = " ;
cin>>pay_rate;

// compute wages
wages = hours_worked * pay_rate;

// display the result
cout << endl ;
cout << "The weekly wages are: tiny_mce_markerquot; << wages << endl ;

}while((hours_worked != -1) && (pay_rate != -1)); //loop ends here
return(0);
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: It contains the c wages program using a repeat loop in
Reference No:- TGS01247836

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)