14. Consider the following class Person Class Person { char Name [20]; char Addr [30]; float Salary; int Property;//in sq. foot area float tax_amount; Public: // methods }; Calculate tax amount by checking salary and the property of the person For salary =5000||=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||<= 10000 sq. foot area amt=3000. 15. Write a C++ program to define function power to raise a number m to a power n the function takes a double value for m. And integervalue for n and return the result correctly use a default value of 2 for n to make the function calculate squares when this argument is omitted


#include<iostream.h>
#include<conio.h>
class person
{
char name[20];
char addr[20];
float sal,tax;
int property;
public:
void get()
{
cout<<“Enter the name address salary property: \n”;
cin>>name>>addr>>sal>>property;
}
void put()
{
cout<<“Person Information:\n”;
cout<<” Name\tAddress\tSalary\tProperty\tTax: \n”;
cout<<“=================================================\n”;
cout<<name<<“\t”<<addr<<“\t”<<sal<<“\t”<<property<<“\t\t”<<tax<<endl;
}
void cal_tax()
{
if(sal<=5000)
{
tax=0;
}
else if(sal>=5000||sal<=10000)
{
tax=(sal*14)/100;
}
else
{
tax=(sal*16)/100;
}
if(property<=1000)
{
tax=tax+0;
}
else if(property>=1000||property<=5000)
{
tax=tax+1000;
}
else
{
tax=tax+3600;
}
}
};
void main()
{
person p;
clrscr();
p.get();
p.cal_tax();
p.put();
getch();
}

Leave a comment