// pgm6b -- modified pgm6 with if stmt // 9/12/16 #include #include using namespace std; int main() { // define variables string first, last; int idnum; double rate,hours,pay; // read in data cout << "Enter employee #1's first name: "; cin >> first; cout << "Enter last name: "; cin >> last; cout << "Enter id number: "; cin >> idnum; cout << "Enter hours worked and rate of pay: "; cin >> hours >> rate; // calculate pay pay = hours * rate; // print everything cout << "Name: " << first << ' ' << last << " id: " << idnum << " Hours: " << hours << " rate: " << rate << endl; cout << "pay for this employee is: " << pay << endl; // now do for second employee // read in data double hours2; cout << "Enter employee #2's first name: "; cin >> first; cout << "Enter last name: "; cin >> last; cout << "Enter id number: "; cin >> idnum; cout << "Enter hours worked and rate of pay: "; cin >> hours2 >> rate; // calculate pay pay = hours2 * rate; // print everything cout << "Name: " << first << ' ' << last << " id: " << idnum << " Hours: " << hours2 << " rate: " << rate << endl; cout << "pay for this employee is: " << pay << endl; if (hours > hours2) cout << "employee 1 worked more hours." << endl; else cout << "employee 2 worked more hours." << endl; return 0; } /* LAB 4 Read in two numbers. Test each number to see if the number is positive or negative (assume 0 is positive). Print a message about each number telling whether it is positive or negative. Do this again for two more numbers. */