Saturday, 23 March 2019

CPP-EX56

 Consider the following C++ class
                 Class Person
                {
                               char Name [20];
            char Addr [30];
            float Salary;
             int Property;    //in sq. foot area
            float tax_amount;
                           Public:
                           // member functions
                 };

    Calculate tax amount by checking salary and the property of the person
         For salary <5000                tax rate=0
                        For salary >=5000||<=10000              tax rate= 14% of salary.
                        For salary >=10000                               tax rate =16% of salary.

    In this tax amount add following amt depending on the size of area in sq.foot
                     For 1000 sq. foot area             amt=0.
                     For >1000|| < 5000 sq. foot area     amt= 1000
                     For >5000||<= 10000 sq. foot area     amt=3000.
                                       


#include<iostream.h>
#include<conio.h>
class person
{
char name[20];
char addr[3];
float salary;
int prop;
float tax_amt;
public:
void co();
float check(float,int);
float property(float ,int );
};

void person:: co()
{
cout<<"\n enter the name of the person";
cin>>name;
cout<<"\n enter the address";
cin>>addr;
cout<<"\n enter the total area of your propertyin sqr foot";
cin>>prop;
tax_amt=check(salary,prop);
cout<<"\n------";
cout<<"\n pune tax paid dept";
cout<<"\n-------";
cout<<"\name "<<name;
cout<<"\n addr "<<addr;
cout<<"\n you want topay tax rs"<<tax_amt;
cout<<" \n ____";
}
float person::property(float s,int a)
{
float t,add;
if(s<5000)
t=0;
else if(s>5000)// s<=10000)
t=0.14*5;
else if(a<=1000)
add=0;
else if(a>10000)//a<=5000)
add=1000;
else if(a>5000)// a<=10000)
add=3000;
t=t+add;
return t;
}