write a c program to calculate the income tax of the
employees in an organization where the conditions are given as.
(I.T. = 0 if income <100000
I.T = 10% if income _< 200000
it = 20% if income >_ 200000)

Answer Posted / mahikshit pandey

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>


//==========================Base Class========================//

class iTax
{
public:
char name[90],ads[90],occ[90];
int ID;

void getit(char *a)
{
strcpy(occ,a);
cout<<"Enter your name: ";
gets(name);
cout<<"Enter your ID: ";
cin>>ID;
cout<<"Give your address in detail: ";
gets(ads);
}

void showit()
{

cout<<"
Name : "<<name;
cout<<"
Occupation :"<<occ;
cout<<"
ID No. : "<<ID;
cout<<"
Address : "<<ads;
}
}; //end of base class


//=================================================================//

class common:public iTax

{
public:
float sal,tax;

void get()
{
cout<<"How much you earn in a year: ";
cin>>sal;
if(sal<50000)
{
tax=sal*(.03);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if((sal>50000)&&(sal<=100000))
{
tax=sal*(.07);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if((sal>100000)&&(sal<=150000))
{
tax=sal*(.10);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if((sal>150000)&&(sal<=200000))
{
tax=sal*(.15);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if((sal>200000)&&(sal<=250000))
{
tax=sal*(.20);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if((sal>250000)&&(sal<=300000))
{
tax=sal*(.23);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
if(sal>300000)
{
tax=sal*(.25);
cout<<"Your IncomeTax is= "<<tax<<"tk."<<endl;
}
}


void showc()
{
cout<<"
Salary : "<<sal<<" tk. in a year";
cout<<"
Tax : "<<tax<<" tk."<<"

";

}

};

//=========================================================//

class p0:public iTax
{

public:
float sal,tax;
void getz()
{
cout<<"Enter your salary in a year: ";
cin>>sal;
cout<<"You have no income tax.
";
}
void showz()
{
cout<<"
Salary : "<<" tk. in a year"<<sal;
cout<<"
Tax : 0 tk.";
}
};

//============================================================//

class p15:public iTax
{

public:
float sal,tax;
void getfn()
{
cout<<"Enter salary in a year: ";
cin>>sal;
tax=sal*(.15);
cout<<"The income tax is: "<<tax<<"tk."<<endl;
}
void showfn()
{
cout<<"
Salary : "<<" tk. in a year"<<sal;
cout<<"
Tax : "<<tax<<" tk."<<"

";
}
};


//===========================================================//

class p20:public iTax
{
public:
float sal,tax;
void getty()
{
cout<<"Enter salary in a year: ";
cin>>sal;
tax=sal*(.20);
cout<<"The income tax is: "<<tax<<"tk."<<endl;
}
void showty()
{
cout<<"
Salary : "<<" tk. in a year"<<sal;
cout<<"
Tax : "<<tax<<" tk."<<"

";
}
};

//==============================================================//

class p25:public iTax
{
public:
float sal,tax;
void gettf()
{
cout<<"Enter salary in a year: ";
cin>>sal;
tax=sal*(.25);
cout<<"The income tax is: "<<tax<<"tk."<<endl;
}
void showtf()
{
cout<<"
Salary : "<<" tk. in a year"<<sal;
cout<<"
Tax : "<<tax<<" tk."<<"

";
}
};


//=======================Main Function=======================//

int main()
{

common c[20];
p0 z[20];
p15 fn[20];
p20 ty[20];
p25 tf[20];
iTax it;

int i,j,index,ID;
char a[70];

clrscr();
do{
cout<<" INCOME TAX CALCULATION"
<<"

What do you want to do?
1.Asking for IncomeTax view."
<<"
2.Search
3.Exit.
"
<<"
Make your choice= ";
cin>>index;

switch(index)
{

case 1:
cout<<"
How many memebers ? ";
cin>>j;
if(j==0)
cout<<"Please enter a valid number.

";

for(i=1;i<=j;i++)
{
cout<<"
Enter occupation name: ";
cin>>a;

if((stricmp(a,"farmer")==0)||(stricmp(a,"student")==0))
{
z[i].getit(a);
z[i].getz();
}

else if(stricmp(a,"business")==0)
{
ty[i].getit(a);
ty[i].getty();
}
else if(stricmp(a,"export")==0)
{
tf[i].getit(a);
tf[i].gettf();
}
else if(stricmp(a,"engineer")==0)
{
fn[i].getit(a);
fn[i].getfn();
}
else
{
c[i].getit(a);
c[i].get();
}
}
break;


case 2:
cout<<"
Give ur employee ID=";
cin>>ID;

if((ID!=c[i].ID)&&(ID!=z[i].ID)&&(ID!=fn[i].ID)&&(ID!=ty[i].ID)&&(ID!=tf[i].ID))
cout<<"No match found.....

";


for(i=1;i<=j;i++)

{
if(ID==c[i].ID)
{
c[i].showit();
c[i].showc();
cout<<"Press any key.......

";
getch();
}

if(ID==z[i].ID)
{
z[i].showit();
z[i].showz();
cout<<"Press any key.......

";
getch();
}

if(ID==fn[i].ID)
{
fn[i].showit();
fn[i].showfn();
cout<<"Press any key.......

";
getch();
}

if(ID==ty[i].ID)
{
ty[i].showit();
ty[i].showty();
cout<<"Press any key.......

";
getch();
}

if(ID==tf[i].ID)
{
tf[i].showit();
tf[i].showtf();
cout<<"Press any key.......

";
getch();
}
} break;




case 3:
break;
default:
cout<<"
a
Wrong choice Try again...";
cout<<"
Press any key to return to main menu...";
getch();
break;
}



}while(index!=3);
return 0;

Is This Answer Correct ?    6 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between the = symbol and == symbol?

619


What is sizeof array?

606


How is null defined in c?

650


The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.

1056


write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values.  The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.

2702






How can I delete a file?

626


What is the use of #define preprocessor in c?

613


What is #include cctype?

576


How many types of arrays are there in c?

591


Implement bit Array in C.

672


shorting algorithmS

1798


Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa. 2. Enter alphanumeric characters and form 2 array alphaets and digits.Also print the count of each array. 3. Find the count of a certain character. 4. Print the positions where a certain character occured. 5. Print the characters between successive array elements. 6. Find the largest and smallest charcter. How many times it each one occured. 7. Enter a certain range. Print out the array elements which occured between these range. 8. Reverse a character array without using another array. 9. Reverse an array region. 10. Replace a the array elements with it next character . Use a after z. 11. Code the array element with certain character as first alphabet. 12. Duplicate all the vowels in a character array. What is the new count. 13. Delete the vowels in a character array. What is the new array count. 14. Print the count of all characters in the array. 15. Enter n alphabets and store a upto tht charcter in array.What is the array count? 16. Sort a character array. 17. Merge 2 character arrays largearray,smallarray. 18. Find the pair with largest number of characters in between. 19. Find the numerical value of a charcter array. 20. Store n numeral characters in an arrray. Insert another numeral character in a certain position. 21. Insert a character in a sorted array. 22. Merge 2 sorted arrays in sorted fashion. 23. Duplicate the least occuring character. 24. Write a menu driven program to circular right/left shift an array of n elements. 25. Is the character array palindrome? if not make it palindrome. 26. Concatenate the first n charaters to the end of the string. 27. Print all n group of chracters which are palindrome. 28. Concatneate the reverse of last n characters to the array.

3340


What are the characteristics of arrays in c?

609


a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.

4540


What are the advantages of the functions?

602