Answer to Question #272826 in C++ for anaya

Question #272826

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.

1
Expert's answer
2021-11-30T18:19:58-0500
#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;
    }
}

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
APPROVED BY CLIENTS