Write a pseudocode that will allow a retail store to process the monthly commission that will be paid to their employees. Your solution will accept the total employees to be processed, and then produce an output showing the commission to be given for each employee, after accepting their name, Taxpayer Registration Number (TRN) and total sales for the month. A 10% commission is given if the total monthly sales is 100,000 or less; however, if the total monthly sales amount exceeds 100,000, the employee gets a commission of 8% of the amount up to and including 100,000 as well as 20% of the amount exceeding 100,000
Pseudocode:
Begin
Declare variable number_of_employees as integer
Declare variables TRN and employee_name as strings
Declare monthlySalary as double
Declare variables monthly_commission and monthly_sales as float
Obtain the number of workers that needs processing from the user
for n = 0 to number_of_employees
input the employee_name
input the TRN for the employee
input the employee_sales
put monthly_commission to be 0.1 * monthly_sales if if monthly_sales <= 100000
set monthly_commission to 0.08 * (100000 + monthly_sales )+ 0.2 * (monthly_sales - 100000) ;
Display the monthly_commission
Stop
The code for the program
#include<iostream>
#include<string>
using namespace std;
int main(){
int number_of_employees;
string employeee_name, TRN;
int x;
float monthly_commission, monthly_sales;
cout<<"Enter the number of employees for processing"<<endl;
cin>>number_of_employees;
for(int n = 0; n<number_of_employees; n++ ){
cout<<"Enter the name of the employee "<<endl;
//getline(cin, employeee_name);
cin>> employeee_name;
cout<<"Enter the TRN of the employee "<<endl;
cin>>TRN;
//getline(cin, TRN);
cout<<"Enter the sales of the employee "<<endl;
cin>> monthly_sales;
if(monthly_sales <= 100000){
monthly_commission = 0.1 * monthly_sales;
}
else if(monthly_sales>100000){
monthly_commission = 0.08 * (100000 + monthly_sales )+ 0.2 * (monthly_sales - 100000) ;
}
cout<<"The commission for the employee is\t"<<monthly_commission<<endl;
}
}
Comments
Leave a comment