Good morning,
Can you guys please figure this out? I have to write a code that calculates de wage of employees on a self generated list.
User is asked for : numberofEmployees, hoursworked, rateperhour.
If the employee works 40 hrs: rate= rate * hrs
between 40 and 50 rate is 1.25
if above 50 = rate is 1.50
we are asked to calculate the grossswage then deduct 15%
Program needs to include -1 to exit
*output should look like this :
Enter number of employees: 2
Employee ID : "(1 to numberofEmployees)"
Enter total hours worked (-1 to exit )
Enter rate per hour:
NetWage is :$
Employee ID: 2 ....
and so on... until the list reaches total of number of employees or user enters -1 ..
So far this is what I have
#include <iostream>
using namespace std;
int main ()
{
int i, k, nEmployees, employeeId;
double hours, rate, salary;
cout <<"\nEnter the number of employees: ";
cin >> nEmployees;
cout <<"\nEnter hours worked: ( type -1 to end):";
cin >> hours;
while (hours != -1.0)
{
// from here
//for loops that decreases no. of employees
for (int i = nEmployees ; i >= nEmployees ; --i )
{
// for loop that tries to increase employee ID and displays it
for (int k = 0 ; k > i; ++k)
cout <<"The employeID is: " << k <<endl;
// to here I dont know what I'm doing
cout << "\nEnter the salary per hour of the employee: ";
cin >> rate;
if (hours <= 40 )
salary = hours * rate;
else if (hours <= 50) ;
salary = (1.25 * rate * (hours - 40) + rate *40);
// else ( salary > 50)
// salary = (rate * 1.50(hours - 50)+ rate * 10 * 1.25 + rate * 40);
cout <<"The salary is $"<<salary * .85<<endl<<endl;
cout <<"\nEnter hours worked: ( type -1 to end):";
cin >> hours;
//} end of for
}
return 0;
}