Advertisement
labib24

Untitled

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