Salary Finder in C++
###### Posted by Samath
Last Updated: October 19, 2014

Mechel Obamah has requested you to develop a C++ application that accepts the hours worked by an employee, as well as the type of employee. Advanced employees are paid five thousand dollars per hour and their overtime pay rate is 1.5 times their normal pay rate. Basic employees are paid a thousand dollars per hour and their overtime pay rate is 1.2 times their normal pay rate. Overtime pay rates is applied when an employee has worked over 40hrs.

Hint: Use a char cariable for employee type i.e. A – Advance and B- Basic

Here is the Solution to the problem above:

```#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
float hours;
float overtime_hours;
char emp_type;
float pay_check;
float over_time;
float total_normal_pay;
float total_overtime_pay;

cout<<"Enter the hours work: ";
cin>>hours;
cout<<"Enter the employee type (A - Advance and B - Basic): ";
cin>>emp_type;

if(emp_type == 'A')
{
pay_check = 5000;
over_time = 1.5 * pay_check;
total_normal_pay = pay_check * 40;
if(hours > 40)
{
overtime_hours = hours - 40;
total_overtime_pay = over_time * overtime_hours;
total_normal_pay = total_normal_pay + total_overtime_pay;
}
cout<<"Employee's Pay: "<<total_normal_pay<<endl;
}
if(emp_type == 'B')
{
pay_check = 1000;
over_time = 1.2 * pay_check;
total_normal_pay = pay_check * 40;
if(hours > 40)
{
overtime_hours = hours - 40;
total_overtime_pay = over_time * overtime_hours;
total_normal_pay = total_normal_pay + total_overtime_pay;
}
cout<<"Employee's Pay: "<<total_normal_pay<<endl;
}

return 0;
}
```
###### C program to enter basic salary of an employee and calculate gross salary
Samath | Jan 02, 2017
###### How do you write a query to find the second highest salary from the Employees table?
MaryJns | Jun 01, 2024
###### How can you find the second highest salary from an employee table?
RoseHrs | Jun 01, 2024
###### How do you write a query to find the nth highest salary in the Employees table?
BobHarris | Aug 01, 2024
###### How do you write a query to find the maximum and minimum salary in each department?
CarolTh | Jun 14, 2024