Answer to Question #340168 in C++ for Chubby

Question #340168

Make a c++ program that will display netpay of employee by inputting the basic pay and overtime pay. It should compute first the gross pay which which is the sum of the input values and the tax which is 10% of the basic pay. The netpay is gross pay minus tax. Use a function for each computation.


1
Expert's answer
2022-05-12T08:19:57-0400
#include <iostream>
using namespace std;

float GrossPay(float regular_hours, float rate_of_pay, float overtime_hours){
	return (regular_hours * rate_of_pay) + (1.5 * overtime_hours * rate_of_pay);
}
float Tax(float grosspay){
	return 0.1*grosspay;
}
float NetPay(float grosspay, float tax){
	return grosspay - tax;
}

int main() {
	float rate_of_pay, regular_hours, overtime_hours, grosspay, netpay, tax;
	cout << "Enter the Hourly rate of pay: ";
	cin >> rate_of_pay;
	cout << "Enter the number of Regular hours: ";
	cin >> regular_hours;
	cout << "Enter the number of Overtime hours: ";
	cin >> overtime_hours;
	grosspay = GrossPay(regular_hours, rate_of_pay, overtime_hours);
	tax = Tax(grosspay);
	netpay = NetPay(grosspay, tax);
	
	cout << "\nEmployee's Gross pay =  " << grosspay << endl;
	cout << "Tax = " << tax << endl;
	cout << "Employee's Net pay = " << netpay << endl;

	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
APPROVED BY CLIENTS