Total salary





Write a program to calculate the total salary of a person. The user has to enter the basic salary (an integer) and the grade (an uppercase character), and depending upon which the total salary is calculated as –

 

totalSalary = basic + hra + da + allow – pf
 
Where.
hra   = 20% of basic
da    = 50% of basic
allow = 1700 if grade = ‘A’
allow = 1500 if grade = ‘B’
allow = 1300 if grade = ‘C' or any other character
pf    = 11% of basic.

Round off the total salary and then print the integral part only.


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int basic  ;
    int allow ;
    char grade ;
    cin >> basic ;
    cin >> grade;
    if(grade == 'A')
    {
      allow = 1700;
    }
     else if(grade == 'B')
     {
       allow = 1500 ;
     
     }else
     {
       allow = 1300;
     }
   basic = round(1.59*basic) ;
   int total = basic + allow ;
  cout << total ;

}
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

1 comments: