Answer to Question #299593 in C++ for saim

Question #299593



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.

1
Expert's answer
2022-02-18T12:50:36-0500
#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);
}

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