starlight company has revised their employees salaries. they had a certain criteria on which they decided the total increment value of employee on their salary, following is the criteria:
20% increase if he has only worked on company's local projects
25% increase if he has only worked on company's international projects
30% increase if he has worked on company's both local & international
Now you are required to ask from 5 employees salary.
#include <iostream>
using namespace std;
int main() {
double salary;
bool local, international;
char ans;
for (int i=0; i<5; i++) {
cout << "Enter a salary for the " << i+1 << "th employee: ";
cin >> salary;
cout << "Does he work on local project [y/N] ";
cin >> ans;
local = (ans == 'n' || ans == 'N') ? false : true;
cout << "Does he work on international project [y/N] ";
cin >> ans;
international = (ans == 'n' || ans == 'N') ? false : true;
if (local && international) {
salary *= 1.3;
}
else if (international) {
salary *= 1.25;
}
else if (local) {
salary *= 1.2;
}
cout << "The new salary is " << salary << endl;
}
}
Comments
Leave a comment