upsidedown

inctx

Feb 24th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include<iostream.h>
  2. class prof;
  3.  
  4. class bank
  5. {
  6.     char gen;
  7.     long double gs;
  8. public:
  9.     friend void inctx(bank,prof);
  10. };
  11.  
  12. class prof
  13. {
  14.     char nm[20];
  15.     char gen1;
  16.     long double ms1;
  17.     friend void inctx(bank,prof);
  18. };
  19.  
  20. void inctx(bank q,prof w)
  21. {
  22.     long double net,intx=0;
  23.     do
  24.     {
  25.     cout<<"enter the name and gender(m/f) of the professor:\n";
  26.     cin>>w.nm>>w.gen1;
  27.     q.gen=w.gen1;
  28.     cout<<"enter the monthly salary(>=190000):\n";
  29.     cin>>w.ms1;
  30.     q.gs=12*w.ms1;
  31.     if(q.gen=='m'||q.gen=='M')
  32.     {
  33.         net=q.gs-180000;
  34.         break;
  35.     }
  36.     else
  37.     {
  38.         if(q.gen=='f'||q.gen=='F')
  39.         {
  40.             net=q.gs-190000;
  41.             break;
  42.         }
  43.         else
  44.         {
  45.             cout<<"invalid gender please enter a valid gender\n";
  46.             continue;
  47.         }
  48.     }
  49.     }while(1);
  50.     if(net<300000)
  51.         intx=0;
  52.     else
  53.     {
  54.         if(net>300000&&net<500000)
  55.             intx=(.10*net);
  56.         else
  57.         {
  58.             if(net>500000&&net<1000000)
  59.                 intx=(.20*net);
  60.             else
  61.                 intx=(.30*net);
  62.         }
  63.     }
  64.     cout<<"Name: "<<w.nm<<endl;
  65.     cout<<"Gender: "<<q.gen<<endl;
  66.     cout<<"Monthly Salary: "<<w.ms1<<endl;
  67.     cout<<"Gross Salary: "<<q.gs<<endl;
  68.     cout<<"Net Salary: "<<net<<endl;
  69.     cout<<"Incometax: "<<intx<<endl;
  70. }
  71.  
  72.  
  73. int main()
  74. {
  75.     bank a;
  76.     prof b;
  77.     inctx(a,b);
  78.     return 0;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment