#include <iostream>
#include <string>
usingnamespace std;
class dog
{
private:
int weight;
string name;
public:
dog();
dog(int,string);
dog(int);
void bark();
void identify();
void setname(string);
};
// 3 constructors
dog::dog()
{
weight = 2;
name="Unknown";
}
dog::dog(int a)
{
weight = a;
name="Mark A.";
}
dog::dog(int a, string b)
{
weight = a;
name = b;
}
void dog::setname(string b)
{
name = b;
}
// Functions:
void dog::bark()
{
if(weight<25)
cout<<"Yip! Yip!";
if(weight>25 && weight<50 )
cout<<"Woof!! Woof!!";
if(weight>50 && weight<100)
cout<<"Woof!! Woof!!";
if(weight>100)
cout<<"You have a fat dog!!";
}
void dog::identify()
{
cout<<name<<" is a "<<weight<<"lb dog."<<endl;
}
int main()
{
string name;
int weight;
cout << "INPUT THE NAME AND WEIGHT OF YOUR DOG" << endl;
cin>>name>>weight;
// creating an object firstDog
dog firstDog(weight,name);
cout<<endl;
// Calling a function for the object firstDog
firstDog.bark();
cout<<endl;
firstDog.identify();
cout<<""<< endl;
cout << "INPUT THE NAME AND WEIGHT OF YOUR DOG" << endl;
cin>>name>>weight;
// creating an object thirdDog
dog thirdDog(weight,name);
cout<<endl;
// Calling a function for the object firstDog
thirdDog.bark();
cout<<endl;
thirdDog.identify();
cout<<""<<endl;
cout<<"THE PROGRAMS DOG";
dog secondDog(95,"Jigar");
cout<<endl;
secondDog.bark();
cout<<endl;
secondDog.identify();
secondDog.setname("Mark A.");
cout<<""<<endl;
cout<<"YOUR DOG WAS RENAMED...";
secondDog.identify();
return 0;
}