Question: Dog.cpp file #ifndef Dog_CPP #define Dog_CPP #include Dog.h Dog::Dog() { weight = 0; height = 0; } Dog::Dog(double w, double h) { weight = w;


Dog.cpp file
#ifndef Dog_CPP
#define Dog_CPP
#include "Dog.h"
Dog::Dog()
{
weight = 0;
height = 0;
}
Dog::Dog(double w, double h)
{
weight = w;
height = h;
}
void Dog::setWeight(double w)
{
weight = w;
}
void Dog::setHeight(double h)
{
height = h;
}
// TODO: Implement the addition operator overload here.
//
//
//
// TODO: Implement the subtraction operator overload here.
// Remember that boxes cannot have negative dimensions.
//
//
// TODO: Implement the multiplication operator overload here.
//
//
//
// TODO: Implement the division operator overload here.
// Remember that division by zero is undefined.
//
//
// TODO: Implement the greater than operator overload here.
//
//
//
// TODO: Implement the less than operator overload here.
//
//
//
// TODO: Implement the equality operator overload here.
//
//
//
// TODO: Implement the not-equal-to operator overload here.
//
//
//
// TODO: Implement the post-increment operator overload here.
//
//
//
// TODO: Implement the pre-increment operator overload here.
//
//
//
// TODO: Implement the post-decrement operator overload here.
//
//
//
// TODO: Implement the pre-decrement operator overload here.
//
//
//
// TODO: Implement the stream insertion operator overload here.
//
//
//
// TODO: Implement the stream extraction operator overload here.
//
//
//
#endif // !Dog_CPP
Dog.h file
#ifndef Dog_H
#define Dog_H
#include
using namespace std;
class Dog
{
// TODO: Provide the prototype to overload the stream insertion
operator here.
// TODO: Provide the prototype to overload the stream extraction
operator here.
public:
Dog();
Dog(double, double);
void setWeight(double);
void setHeight(double);
// TODO: Provide the prototype to overload the addition operator
here.
// TODO: Provide the prototype to overload the subtraction operator
here.
// TODO: Provide the prototype to overload the multiplication
operator here.
// TODO: Provide the prototype to overload the division operator
here.
// TODO: Provide the prototype to overload the greater than operator
here.
// TODO: Provide the prototype to overload the less than operator
here.
// TODO: Provide the prototype to overload the equality operator
here.
// TODO: Provide the prototype to overload the not-equal-to operator
here.
// NOTE: For the sake of this lab, we are comparing dogs by
multiplying their height and weight.
// However, in reality, all dogs are good dogs.
// TODO: Provide the prototype to overload the pre-increment
operator here.
// TODO: Provide the prototype to overload the post-increment
operator here.
// TODO: Provide the prototype to overload the pre-decrement
operator here.
// TODO: Provide the prototype to overload the post-decrement
operator here.
private:
double weight;
double height;
};
#endif // Dog_H
main.cpp file
#include "Dog.h"
int main()
{
Dog dog1;
Dog dog2;
cout
dog1: ";
cin >> dog1;
cout
cout
cout
dog2: ";
cin >> dog2;
cout
cout
cout
cout
cout
cout
cout
cout
cout
cout
if (dog1 > dog2)
cout dog2"
if (dog1
cout
if (dog1 == dog2)
cout
if (dog1 != dog2)
cout
cout
cout
cout
cout
Dog dog3 = dog2++;
cout
cout
cout
cout
cout
system("pause");
return 0;
}
Question 1: The Dog class holds the weight and height of a dog. Instances of the Dog class are considered equal if their respective weights * heights are equal. Arithmetic can be performed on instances of the Dog class by performing arithmetic operations on their respective dimensions. Consider that dogl's weight-50 pounds, and height-20 inches. Consider that dog2's weight-20 pounds, and height = 10 inches. Dog dog3 dog1 -dog2 dog3 will have a weight of 30 pounds and a height of 10 inches. Dog objects can be incremented decremented by increasing/decreasing their respective dimensions by 1 Consider that dogl's weight-50 pounds, and height-20 inches. dog1 dogl now has a weight of 51 pounds and a height of 21 inches. Write the Dog class and overload the following operators (using either member or non member functions): Addition, Subtraction, Multiplication, Division, Greater Than, Less Than, Equal To, Not Equal To, Pre-Increment, Pre-Decrement, Post-Increment, and Post-Decrement. Keep in mind that a dog cannot have negative dimensionsI any calulation results in a negative dimension, set all dimensions to the default 0 Next, overload the stream insertion and stream extraction operators, so the following main test function produces the shown output. Your Dog class and operator overloads should work with the included main function. Please don't alter main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
