Design and implement an adt class pet for an animal


(Q.) Design and Implement an ADT class Pet for an animal hospital using separate compilation. You are required to write syntactically corret C++ code. Specifically, the animal hospital will consider the following attributes of a pet ( 1) name, (2) age in years, (3) type, which could be one of the following values.: {cat, dog, bird, others} and (4) wieght. Make sure that your ADT class will include the following member function int its interface

(1) A default constructor that initializes all the data members accordingly.

(2) A read-onlaccessor to return the name of a pet

(3) A read-only accessor to return the type of a pet

(4) A mutator to change the weight of a pet

(5) An overloadeded == (equal) operator to compare two pets. This operator will return true if two pets are of the same age and type, false other otherwise. This operator is not allowed to change either of the two participating Pet objects.

(6) An overloaded put operator (<<) as a friend function to print out a pet's information .

(Q.I) Write down the header file pet h . Consise commetns are required.

(Q.2)Implement the following member functions declared in the above header file in diffrent file pet.cpp

//pet.cpp starts here

#include "pet.h"

a) Implement the default constructor using an initializer(i.e., initialization segment). Feel free to choose the initial value of each data member as you see fit.

b)Implement the accessor that returns the name of a pet

c)Implement the overloaded ==(equal) operator

d)Implement the put(<<) operator

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design and implement an adt class pet for an animal
Reference No:- TGS02908458

Expected delivery within 24 Hours