Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 18.188.107.57
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/vnlaughlin/../cchansen/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/vnlaughlin/../cchansen/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(numdep < 2 && taxstatus == 'm')
     tax = .20 * grosspay;
  if(numdep < 2 && taxstatus == 's')
     tax = .30 * grosspay;
  if(numdep >= 2 && taxstatus == 'm')
     tax = .15 * grosspay;
  if(numdep >= 2 && taxstatus == 's')
     tax = .25 * grosspay;

//   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