/* Mike Roth. This program calculates net balance after deducting state and * federal taxes in addition with FICA. The variables are idnum gross, ftax, * stax, fica, and net. They represent the person's identification number, * the gross profit of the person, the federal tax, the state tax, the FICA * deducation, and the new net balance respectively. The input is through the * keyboard and the output is to the monitor. */ #include #include int main() { int idnum; double gross, ftax, stax, fica, net; do { cout << "Please enter id number greater than 0, or 0 to quit: "; cin >> idnum; } while (idnum < 0); while (idnum != 0) { do { do { cout << "Enter a number greater than 0 for gross pay: "; cin >> gross; } while (gross < 0 || gross == 0); do { cout << "Enter a number greater than 0 for federal tax: "; cin >> ftax; } while (ftax < 0 || ftax >= gross); do { cout << "Enter a number greater than 0 for state tax: "; cin >> stax; } while (stax < 0 || stax >= gross); do { cout << "Enter a number greater than 0 for FICA: "; cin >> fica; } while (fica < 0 || fica >= gross); } while (ftax+stax+fica > gross); cout.setf(ios::fixed | ios::showpoint); cout.precision(2); net = gross - (ftax+stax+fica); cout << "\nGross Profit:" << setw(16) << "$" << setw(10) << gross; cout << "\nFederal Tax:" << setw(17) << "$" << setw(10) << ftax; cout << "\nState Tax:" << setw(19) << "$" << setw(10) << stax; cout << "\nFICA:" << setw(24) << "$" << setw(10) << fica; cout << "\nNet Profit:" << setw(18) << "$" << setw(10) << net; do { cout << "\n\nPlease enter id number greater than 0, or 0 to quit: "; cin >> idnum; } while (idnum < 0); } cout << "\nGoodbye."; return 0; }