Total salary send feedback 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 -
Answers
Answer:
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.
Input format :
Basic salary & Grade (separated by space)
Output Format :
Total Salary
Sample Input 1 :
10000 A
Sample Output 1 :
17600
Sample Input 2 :
4567 B
Sample Output 2 :
8762
Answer:
Here is the C++ Program
Explanation:
#include<iostream>
#include <cmath>
using namespace std;
int main() {
// Write your code here
char grade;
double basic,hra,da,allow,pf,totalSalary;
cin>>basic>>grade;
hra = basic*0.20;
da = basic*0.50;
if (grade == 65){
allow = 1700;
}
else if (grade == 66){
allow = 1500;
}
else {
allow = 1300;
}
pf = basic*0.11;
totalSalary = basic + hra + da + allow - pf;
cout << round(totalSalary);
}