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:
Start
Declare variable totalEmployees as integer
Declare variable employeeName as string
Declare variable TRN as string
Declare variable monthSales as float
Declare variable monthlyCommission as float
Get the total employees to be processedy from the user
for i=0 to totalEmployees step 1Â
Get the employee name (employeeName) from the user
Get the employee Taxpayer Registration Number (TRN) from the user
Get the employee sales for the month (monthSales) from the user
Set monthlyCommission to monthSales*0.1
if monthSales>100000 then
Set monthlyCommission to 0.08*100000+0.2*(monthSales-100000) Â
Display the monthlyCommission
End
C++ code:
#include <iostream>
#include <string>
using namespace std;
int main(){
int totalEmployees=0;
string employeeName;
string TRN;
float monthSales;
float monthlyCommission;
cout<<"Enter the total employees to be processedy: ";
cin>>totalEmployees;
cin.ignore();
//Taxpayer Registration Number (TRN) and total sales for the month.
for(int i=0;i<totalEmployees;i++){
cout<<"Enter the employee name: ";
getline(cin,employeeName);
cout<<"Enter the employee Taxpayer Registration Number (TRN): ";
getline(cin,TRN);
cout<<"Enter the employee sales for the month: ";
cin>>monthSales;
//A 10% commission is given if the total monthly sales is 100,000 or less;Â
monthlyCommission=monthSales*0.1;
//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.
if(monthSales>100000){
monthlyCommission=0.08*100000+0.2*(monthSales-100000);
}
cout<<"The monthly commission is: "<<monthlyCommission<<"\n\n";
cin.ignore();
}
system("pause");
  return 0;
}
Comments
Leave a comment