#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <string>
usingnamespace std;
//Defintion of Dog Class
class Dog {
public:
Dog(); //Constructor
~Dog(); //Destructor
void setName(string name);
void setAge(int age);
void setWeight(int weight);
string getName();
int getAge();
int getWeight();
void speak();
private:
string name;
int age;
int weight;
};
//Implementation of Dog Class menthods
//Constructor
Dog::Dog() {
age = 0;
weight = 0;
cout << "Dog Constructor Called" << endl;
}
//Destructor
Dog::~Dog()
{
cout << "Dog Destructor Called" << endl;
}
//Setter methods
void Dog::setName(string name)
{
this->name = name;
}
void Dog::setAge(int age)
{
this->age = age;
}
void Dog::setWeight(int weight)
{
this->weight = weight;
}
//Getter methods
string Dog::getName()
{
return name;
}
int Dog::getAge()
{
return age;
}
int Dog::getWeight()
{
return weight;
}
void Dog::speak()
{
cout << "BARK!!" << endl;
}
int main()
{
Dog myPet = Dog(); //an object of Dog class is instantiated
myPet.setName("Rusty");
myPet.setAge(2);
myPet.setWeight(14);
cout << "My Pet Details are ... \n";
cout << "Name: " << myPet.getName() << endl;
cout << "Age: " << myPet.getAge() << endl;
cout << "Weight: " << myPet.getWeight() << endl;
cout << "My dog can ";
myPet.speak();
cout << endl;
//declare another dog objet names yourPet and assign the following:
Dog yourPet = Dog();
yourPet.setName("Topsy");
yourPet.setAge(3);
yourPet.setWeight(16);
cout << "Your Pet Details are ... \n";
cout << "Name: " << yourPet.getName() << endl;
cout << "Age: " << yourPet.getAge() << endl;
cout << "Weight: " << yourPet.getWeight() << endl;
cout << "My dog can ";
yourPet.speak();
cout << endl;
system("PAUSE");
return 0;
}
the user is prompted to enter name, age and weight of yourPet and myPet from the keyboard. Assign the values to yourPet and myPet object and print the details
yes i know the cin but what i dont know is what is the variable that should set to the cin and is theres anything in the code that should change in order for the cin code to run