Server IP : 172.16.15.8 / Your IP : 18.219.231.197 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/drsparks/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#include <iostream> #include <iomanip> using namespace std; int main() { int numdep; // number of dependents float grosspay, // gross pay tax, // tax withheld netpay; // net pay char taxstatus; // married or single cout << "\n\nWelcome to the Payroll Calculation Program!\n\n"; cout << "Enter gross pay: "; cin >> grosspay; cout << "Enter number of dependents: "; cin >> numdep; cout << "Enter status (m for married, s for single): "; cin >> taxstatus; if (taxstatus == 'm' && numdep >= 2) tax = .15 * grosspay; else if (taxstatus == 'm' && numdep < 2) tax = .2 * grosspay; else if (taxstatus == 's' && numdep >= 2) tax = .25 * grosspay; else tax = .3 * grosspay; netpay = grosspay - tax; cout << fixed; // force fixed point format cout << setprecision(2); // forces results to look like dollars & cents cout << "\n\nYour net pay is $ " << netpay << "\n\n"; return 0; }