Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.118.162.8
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/lmking1/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/lmking1/tax.cpp
//-------------------------------------------------------------------------
//
// Example of nested if .. else control structures
//
// Calculates payroll taxes based on number of dependents and 
//    married/single status.
//
// Note:  Assumes all input is valid.
//
// Written by K. Ames
// September 17, 2008
//
//-------------------------------------------------------------------------

// ---- Preprocessor Section

#include <iostream>
#include <iomanip>
using namespace std;

// ---- Main Function

int main()
{

// ---- Variables

int
   numdep;     // number of dependents

float
   grosspay,   // gross pay
   tax,        // tax withheld
   netpay;     // net pay

char
   taxstatus;  // married or single


// Input values (in a "normal" payroll program,
//      gross pay would be calculated, of course)

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;


//   First, calculate tax to be withheld

if(taxstatus == 'm' && numdep < 2)
  tax = .2 * grosspay;
else if(taxstatus == 'm' && numdep >= 2)
    tax = .15 * grosspay;
  else if(taxstatus == 's' && numdep < 2)
      tax = .3 * grosspay;
    else if(taxstatus == 's' && numdep >= 2)
        tax = .25 * grosspay;  

//         your code goes here!!!!


//   Now calculate net pay and display results

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;
}

Stv3n404 - 2023