C++ Program Basic Salary of the employee with dearness allowance
Write a program that inputs the name, Basic Salary of the employee. The program calculates 35% dearness allowance, 25% house rent of the employee from the basic salary then displays the gross salary which is adds basic salary, dearness allowance and house rent of the employee.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; int main() { string employeeName; double basicSalary, dearnessAllowance, houseRent, grossSalary; cout << "Enter employee's name: "; cin >> employeeName; cout << "Enter the basic salary: "; cin >> basicSalary; // Calculating dearness allowance and house rent dearnessAllowance = 0.35 * basicSalary; houseRent = 0.25 * basicSalary; // Calculating gross salary grossSalary = basicSalary + dearnessAllowance + houseRent; cout << "Employee Name: " << employeeName << endl; cout << "Basic Salary: " << basicSalary << endl; cout << "Dearness Allowance (35%): " << dearnessAllowance << endl; cout << "House Rent (25%): " << houseRent << endl; cout << "Gross Salary: " << grossSalary << endl; return 0; } |
Output
Enter employee’s name: Ali
Enter the basic salary: 20000
Employee Name: Ali
Basic Salary: 20000
Dearness Allowance (35%): 7000
House Rent (25%): 5000
Gross Salary: 32000