Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- class prof;
- class bank
- {
- char gen;
- long double gs;
- public:
- friend void inctx(bank,prof);
- };
- class prof
- {
- char nm[20];
- char gen1;
- long double ms1;
- friend void inctx(bank,prof);
- };
- void inctx(bank q,prof w)
- {
- long double net,intx=0;
- do
- {
- cout<<"enter the name and gender(m/f) of the professor:\n";
- cin>>w.nm>>w.gen1;
- q.gen=w.gen1;
- cout<<"enter the monthly salary(>=190000):\n";
- cin>>w.ms1;
- q.gs=12*w.ms1;
- if(q.gen=='m'||q.gen=='M')
- {
- net=q.gs-180000;
- break;
- }
- else
- {
- if(q.gen=='f'||q.gen=='F')
- {
- net=q.gs-190000;
- break;
- }
- else
- {
- cout<<"invalid gender please enter a valid gender\n";
- continue;
- }
- }
- }while(1);
- if(net<300000)
- intx=0;
- else
- {
- if(net>300000&&net<500000)
- intx=(.10*net);
- else
- {
- if(net>500000&&net<1000000)
- intx=(.20*net);
- else
- intx=(.30*net);
- }
- }
- cout<<"Name: "<<w.nm<<endl;
- cout<<"Gender: "<<q.gen<<endl;
- cout<<"Monthly Salary: "<<w.ms1<<endl;
- cout<<"Gross Salary: "<<q.gs<<endl;
- cout<<"Net Salary: "<<net<<endl;
- cout<<"Incometax: "<<intx<<endl;
- }
- int main()
- {
- bank a;
- prof b;
- inctx(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment