Advertisement
labib24

Untitled

May 21st, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class employee
  5. {
  6.     int   emp_number;
  7.     char  emp_name[20];
  8.     float emp_basic;
  9.     float emp_da;
  10.     float emp_it;
  11.     float emp_net_sal;
  12.  
  13. public:
  14.  
  15.     void get_emp_details();
  16.     float find_net_salary(float basic, float da, float it);
  17.     void show_emp_details();
  18. };
  19.  
  20. void employee :: get_emp_details()
  21. {
  22.     cout<<"\nEnter employee number: ";
  23.     cin>>emp_number;
  24.     cout<<"\nEnter employee name: ";
  25.     cin>>emp_name;
  26.     cout<<"\nEnter employee basic: ";
  27.     cin>>emp_basic;
  28.     cout<<"\nEnter employee bonus: ";
  29.     cin>>emp_da;
  30.     cout<<"\nEnter employee Income Tax: ";
  31.     cin>>emp_it;
  32. }
  33.  
  34. float employee :: find_net_salary(float basic, float da, float it)
  35. {
  36.     return (basic+da)-it;
  37. }
  38.  
  39. void employee :: show_emp_details()
  40. {
  41.     cout<<"\n\n**** Details of  Employee ****";
  42.     cout<<"\nEmployee Name      :  "<<emp_name;
  43.     cout<<"\nEmployee number    :  "<<emp_number;
  44.     cout<<"\nBasic salary       :  "<<emp_basic;
  45.     cout<<"\nEmployee bonus     :"   <<emp_da;
  46.     cout<<"\nIncome Tax         :  "<<emp_it;
  47.     cout<<"\nNet Salary         :  "<<find_net_salary(emp_basic, emp_da, emp_it);
  48.     cout<<"\n-------------------------------\n\n";
  49. }
  50.  
  51.  
  52. int main()
  53. {
  54.     employee emp;
  55.  
  56.     emp.get_emp_details();
  57.     emp.show_emp_details();
  58.  
  59.     return 0;
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement