Answer to Question #277689 in C++ for Nicole

Question #277689

Create a C Language program that will compute and display the following:


Sample Output

EMPLOYEE NUMBER :

EMPLOYEE NAME :

BASIC SALARY :

OVERTIME PAY :

ALLOWANCE :

SSS :

PAG-IBIG :

WITHHOLDING TAX :

GROSS PAY :

TOTAL DEDUCTION :

NET PAY :

*compute the GROSS PAY, TOTAL DEDUCTION and NET PAY


1
Expert's answer
2021-12-09T17:37:52-0500
#include <stdio.h>


struct Employee
{
	int number;
	char name[15];
	double net_salary;
	double overtime_pay;
	int allowance;
	double sss;
	double pag_ibig;
	double withholding_tax;
	double gross_pay;
	double total_deduction;
	double net_pay;


	void gross_pay_compute()
	{
		gross_pay = net_salary + overtime_pay;
	}


	void total_deduction_compute()
	{
		total_deduction = gross_pay * sss / 100 + gross_pay * pag_ibig / 100 + gross_pay * withholding_tax / 100;
	}
	void net_pay_calc()
	{
		net_pay = gross_pay - total_deduction;
	}


};
int main() 
{
	Employee emp{ 1, "Yuliia", 1200, 200, 3, 2.5, 4.2, 12.5 };
	emp.gross_pay_compute();
	emp.total_deduction_compute();
	emp.net_pay_calc();
	printf("Employee number %d, name %s, basic salary %f, overtime %f, allowance %d. sss is %f, pag-ibig is %f, withholding tax is %f.", emp.number, emp.name, emp.net_salary, emp.overtime_pay, emp.allowance, emp.sss, emp.pag_ibig, emp.withholding_tax);
	printf("\nSo her gross salary is %f, total deduction is %f, net pay is %f.", emp.gross_pay, emp.total_deduction, emp.net_pay);


	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