-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem_020.cpp
More file actions
32 lines (32 loc) · 773 Bytes
/
problem_020.cpp
File metadata and controls
32 lines (32 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//Write a C++ program to read the data of N employee and compute Net salary
//of each employee(DA=52% of basic and Income Tax(IT)=30% of the gross salary)
#include<iostream>
using namespace std;
float DA(float basic){
return 0.52* basic;
}
float gross(float basic){
return basic + DA(basic);
}
float incomeTax(float basic)
{
return 0.30 * gross(basic);
}
float netSalary(float basic)
{
return gross(basic)-incomeTax(basic);
}
int main()
{
int N;
cout<<"Enter number of employees:";
cin>>N;
for(int i=0;i<N;i++)
{
float basic_salary;
cout<<"Enter the basic salary for employee "<<i+1<<":";
cin>>basic_salary;
cout<<"Net salary for employee "<<i+1<<": "<<netSalary(basic_salary)<<endl;
}
return 0;
}