/* Andras Konya October 4, 2001 Chapter 4 Exercise 4 --- Gross Wages and Taxed Wages*/ #include int main () { int work; // defines hours worked double rate; // defines hourly rate char exempt; // will ask whether or not yes or no // no line cout <<"Enter hours worked: "; // asks user cin >> work; // gets number of hours worked cout <<"Enter hourly rate: "; // asks user cin >> rate; // gets hourly rate cout <<"Are you exempt? (Y/N): "; // ask user the question cin >> exempt; // gets whether or not person exempt from taxes cout << endl; // skips line // no line cout.setf(ios::fixed); // needed to set decimal places cout.precision(2); // sets decimal places to 2 so dollars and // cents can be correctly written // no line if ((exempt=='n')||(exempt=='N')) { // if not exempt cout <<"Gross wages = $"; // wages before taxes cout <<(work*rate); // formula cout << endl; // skips line cout <<"Wages after taxes = $"; // wages after taxes cout <<(work*rate)*.82;} // formula // no line else if((exempt=='y')||(exempt=='Y')) { // if exempt cout <<"Gross wages = $"; // wages before taxes cout <<(work*rate); // formula cout << endl; // skips line cout <<"NO TAXES DEDUCTED";} // displays NO TAXES DEDUCTED // no line char dummy; // so screen does not flash cin >> dummy; // so screen does not flash return (0); } // end of program