/*write a c++ program to consider the follwing class person
class person
{
char name[20];
char addr[30];
flaot salary;
int property;
flaot tax;
public:\\method
};
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 sqr.foot
for 100 sqr.foot amt=0
for>1000||<5000 amt=1000
for>5000||<=10000 amt=3000
*/
#include<conio.h>
#include<iostream.h>
class person
{
char name[20],addr[30];
float sal,tax_amt;
int prop;
public:void accept();
void display();
};
void person::accept()
{
cout<<"\nenter the name:-";
cin>>name;
cout<<"\nenter address:-";
cin>>addr;
cout<<"\nenter salary:-";
cin>>sal;
cout<<"\nenter how much Rs. of property you have:-";
cin>>prop;
tax_amt=0;
if(sal<5000)
tax_amt=tax_amt+0;
if(sal>=5000&&sal<=10000)
tax_amt=tax_amt+(sal*0.14);
if(sal>=10000)
tax_amt=tax_amt+(sal*0.16);
if(prop==1000)
tax_amt=tax_amt+0;
if(prop>1000&&prop<5000)
tax_amt=tax_amt+1000;
if(prop>5000&&prop<=10000)
tax_amt=tax_amt+3000;
}
void person::display()
{
cout<<"\nname:-"<<name;
cout<<"\naddress:-"<<addr;
cout<<"\nsalary:-"<<sal;
cout<<"\nproperty:-"<<prop;
cout<<"\ntax amount:-"<<tax_amt;
}
int main()
{
person p;
clrscr();
p.accept();
p.display();
getch();
return 0;
}
/*
enter the name:-fdfsd
enter address:-asdasd
enter salary:-5000
enter how much Rs. of property you have:-10000
name:-fdfsd
address:-asdasd
salary:-5000
property:-10000
tax amount:-3700
*/
class person
{
char name[20];
char addr[30];
flaot salary;
int property;
flaot tax;
public:\\method
};
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 sqr.foot
for 100 sqr.foot amt=0
for>1000||<5000 amt=1000
for>5000||<=10000 amt=3000
*/
#include<conio.h>
#include<iostream.h>
class person
{
char name[20],addr[30];
float sal,tax_amt;
int prop;
public:void accept();
void display();
};
void person::accept()
{
cout<<"\nenter the name:-";
cin>>name;
cout<<"\nenter address:-";
cin>>addr;
cout<<"\nenter salary:-";
cin>>sal;
cout<<"\nenter how much Rs. of property you have:-";
cin>>prop;
tax_amt=0;
if(sal<5000)
tax_amt=tax_amt+0;
if(sal>=5000&&sal<=10000)
tax_amt=tax_amt+(sal*0.14);
if(sal>=10000)
tax_amt=tax_amt+(sal*0.16);
if(prop==1000)
tax_amt=tax_amt+0;
if(prop>1000&&prop<5000)
tax_amt=tax_amt+1000;
if(prop>5000&&prop<=10000)
tax_amt=tax_amt+3000;
}
void person::display()
{
cout<<"\nname:-"<<name;
cout<<"\naddress:-"<<addr;
cout<<"\nsalary:-"<<sal;
cout<<"\nproperty:-"<<prop;
cout<<"\ntax amount:-"<<tax_amt;
}
int main()
{
person p;
clrscr();
p.accept();
p.display();
getch();
return 0;
}
/*
enter the name:-fdfsd
enter address:-asdasd
enter salary:-5000
enter how much Rs. of property you have:-10000
name:-fdfsd
address:-asdasd
salary:-5000
property:-10000
tax amount:-3700
*/
No comments:
Post a Comment