Write a program that calculates and prints the monthly paycheck for an employee. The program takes as input
the gross pay and name of the employee from the user. It then calculates the net pay after taking the following
deductions on the gross pay:
Income Tax = 15%
Medicare Tax = 3.5%
Pension Fund = 2.75%
House Rent = 1000 Rs (fixed amount)
T
#include <iostream>
#include <string>
using namespace std;
int main(){
string name;
double grossPay;
cout<<"Enter the name of the employee: ";
getline(cin,name);
cout<<"Enter the gross pay of the employee: ";
cin>>grossPay;
double incomeTax=grossPay *0.15;
double medicareTax=grossPay *0.035;
double pensionFund=grossPay *0.0275;
double netPay=grossPay -incomeTax-medicareTax-pensionFund-1000;
cout<<"Income Tax = 15%: "<<incomeTax<<"\n";
cout<<"Medicare Tax = 3.5%: "<<medicareTax<<"\n";
cout<<"Pension Fund = 2.75%: "<<pensionFund<<"\n";
cout<<"House Rent = 1000 Rs\n";
cout<<"The net pay = "<<netPay<<"\n\n";
system("pause");
return 0;
}
Comments
Leave a comment