Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Name: Aakash Netada
- // Roll no.: 52
- // Batch : S3
- // Q. Write a c++ program for calculating employee yearly salary and income tax.
- #include<iostream>
- #include <cstring>
- #include <iomanip>
- using namespace std;
- class taxpayer
- {
- private:
- char name[30];
- int salary,gross,hra,da;
- float tax;
- public:
- taxpayer() // constructor making
- {
- name[30] = 0;
- gross= 0;
- tax = 0;
- hra=0;
- da=0;
- salary=0;
- }
- void Input();
- void formula();
- void Calctax();
- };
- void taxpayer::Input()
- {
- cout << "\nEnter Name : ";
- cin >> name;
- cout << "\nEnter Salary : ";
- cin >> salary;
- }
- void taxpayer::formula()
- {
- if(salary<= 100000)
- {
- da=salary*20/100;
- hra=salary*80/100;
- gross=salary+da+hra;
- cout<<"the gross salary of the employee is="<<gross<<endl;
- }
- if(salary<= 200000)
- {
- da=salary*25/100;
- hra=salary*90/100;
- gross=salary+da+hra;
- cout<<"the gross salary of employee is="<<gross<<endl;
- }
- else if(salary>200000)
- {
- da=salary*30/100;
- hra=salary*95/100;
- gross=salary+da+hra;
- cout<<"the gross salary of employee is="<<gross<<endl;
- }
- else if(salary>500000)
- {
- da=salary*45/100;
- hra=salary*95/100;
- gross=salary+da+hra;
- cout<<"the gross salary of employee is="<<gross<<endl;
- }
- else
- {
- cout<<"you have no salary"<<endl;
- }
- }
- void taxpayer::Calctax()
- {
- if ( gross<= 100000)
- {
- tax = 0;
- cout << "No tax is charged." << endl;
- }
- else if ( gross > 100000 && gross <= 200000)
- {
- tax = 0.1 * gross;
- cout << "Tax of 10% of total income is charged and the tax amount is : " << tax << endl;
- }
- else if ( gross > 200000 && gross <= 500000)
- {
- tax = 0.15 * gross;
- cout << "Tax of 15% of total income is charge and the tax amount is : " << tax << endl;
- }
- else
- {
- tax = 0.2 * gross;
- cout << "Tax of 20% of total income is charged and the tax amount is : " << tax << endl;
- }
- }
- int main()
- {
- taxpayer t;
- t.Input();
- t.formula();
- t.Calctax();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement