Create program using appropriate control structure.
3. Suria is ready to develop a system that will automate the process of calculating payroll for employees worked at Infinity Design Solution Sdn. Bhd. Each employee will be recognized by employee ID. The system will receive gross income, allowance, overtime, income tax and loan deduction. The system will automatically calculate the total income, total deduction and net salary for the employee. System will calculate the total income based total deduction. Help Suria to create the program.
#include <iostream>
using namespace std;
int main()
{
double income, allowance, overtime_money;
double income_tax = 0.15, loan;
int hours_overtime;
cout << "Enter the income: ";
cin >> income;
cout << "Enter allowance an employee: ";
cin >> allowance;
cout << "Enter how many hours your employee worked overtime: ";
cin >> hours_overtime;
cout << "Enter overtime money for one hour: ";
cin >> overtime_money;
cout << "Enter loan %: ";
cin >> loan;
double overtime = hours_overtime * overtime_money;
double gross_income = income + allowance + overtime;
double loan_deduction = loan/100 * 1000;
double salary = gross_income - loan_deduction - (gross_income * income_tax);
cout << "The final salary for this employee = " << salary;
return 0;
}
Comments
Leave a comment