Answer to Question #306411 in C++ for Hoorain Fatima

Question #306411

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

1
Expert's answer
2022-03-05T06:47:56-0500


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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog