OOPc using C++

With this blog I want to share my knowledge of OOPs and C++. I Hope this can quench your thirst for learning.Any suggestions and comments are welcome.
Showing posts with label Program to find sales commission. Show all posts
Showing posts with label Program to find sales commission. Show all posts

Tuesday, August 3, 2010

Program 2 - Program to enter the sale value and print the agent's commission


This program takes in the total sale value as a screen input from the user.
The program then calculates the agent's commission with the help of the 'IF-ELSE' command as follows :
5% if the total sale value is less than or equal to Rs10000.
10% if the total sale value is less than or equal to Rs.25000.
20% if the total sale value is greater than Rs.25000. It then outputs the agent's commission using the 'cout' command.


#include <iostream.h>
#include <conio.h>

void main( )
{
           clrscr( );
           long int svalue;
           float commission;
           cout << "Enter the total sale value : " << endl;
           cin>>svalue;
         if(svalue<=10000)
         {
                     commission=svalue*5/100;
                     cout << "For a total sale value of $" << svalue << ", ";
                     cout << "the agent's commission is $" << commission;
          }
         else if(svalue<=25000)
          {
                   commission=svalue*10/100;
                   cout << "For a total sale value of $" << svalue << ", ";
                   cout << "the agent's commission is $" << commission;
            }
        else if(svalue>25000)
          {
                   commission=svalue*20/100;
                   cout << "For a total sale value of $" << svalue << ", ";
                   cout << "the agent's commission is $" << commission;
            }
getch();
}                  



Sample Input:
26000

Sample Output:
For a total sale value of Rs.26000,
the agent's commission is Rs.5200