Write a program in C++ that calculate the bonus of a sales person
Posted by Samath
Last Updated: November 02, 2014

In January of each year, Miller Incorporated pays a 5% bonus to each of its salespeople. The bonus is based on the amount of sales made by the sales person during the previous year. The payroll clerk wants a C++ program that calculates and displays the bonus amounts for as many salespeople as needed without having to run the program more than once. Because the sales amounts entered by the payroll clerk will always be positive numbers, the payroll clerk will indicate that he is finished with the program by entering a sales amount of –1 (a negative number 1).

 

Here is the Solution to the problem above:

#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
	float amount;
	float bonus;
	while(amount!=-1)
	{
         cout<<"Enter sales amount: ";
	     cin>>amount;
	     
		if(amount >= 0)
		{
			bonus = (amount/100)*5;
			cout<<"Sales bonus: "<<bonus<<endl;
		}
			
	}
	
	return 0;
}