Ask a Teacher



Write a program in c++ to calculate the commission for the salesmen. The commission is calculated as follows. Sales Made Commission Rate 30001 onwards 15% 22001 to 30000 10% 12001 to 22000 7% 5001 to 12000 3% 0 to 5000 0%

#include <iostream>
#include<iomanip>
          using namespace std
int main ( )
{
       // declare variable
          int sales = 0 ;
          double commission = 0.0 ;
       //enter input
      cout<<"sales :" ;
      cin>> sales ;
      // determine commission

      if (sales > 5000)
                 commission = 0 ;
      elseif (sales >=12000)
               commission = sales * .03 ;
       elseif (sales >= 22000)
               commission = sales * .07 ;
       elseif (sales >=30000)
                commission = sales * .10 ;
       elseif (sales > 30000)
                     commission=sales * .15 ;
        //endif
       //display commission or error message
         return 0 ;
  }      //end of main function      


comments powered by Disqus