A company decided to give bonus of 5% to employee if his/her year of service is more than 5 years. Ask user for their salary and year of service and print the net bonus amount.
#include<iostream>
using namespace std;
int main()
{
double salary;
int yerOfServ;
do
{
cout << "\nPlease, enter a salary (0 - exit program): ";
cin >> salary;
if (salary == 0)break;
cout << "Please, enter year of service: ";
cin >> yerOfServ;
if (yerOfServ > 5)
{
cout << "\nNet bonus amount is " << 0.05*salary;
cout<<"\nResult salary is "<< salary + 0.05*salary;
}
else
{
cout << "\nNet bonus amount is " << 0;
cout << "\nResult salary is " << salary;
}
} while (true);
}
Comments
Leave a comment