Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Plz right this in c++ code write a class called Dog. must separate implementatio

ID: 3802745 • Letter: P

Question

Plz right this in c++ code write a class called Dog. must separate implementation from declaration (separate compilation). You Dog contains the following private data: name, breed, weight, kennel number, and a static fie for adoption fee. The current adoption fee is $75.00. Create accessor and mutator functions for each data element. Create two constructors for Dog 1) A default constructor that gives the following values: a. Name is "Spot" b. Breed is "mutt" c. Weight is 50.5 d. Kennel number is 1 2) A non-default constructor that uses default parameters to assign "Rover" to name if none is given, and requires breed, weight, and kennel number. Create a destructor that states "You are removing" and the name of the dog being removed. overload the insertion and extraction operators so to input data for a dog and to display data for a dog. Be sure to show exactly two decimal points when displaying the adoption fee and one decimal point when displaying the weight. Your main function will perform the following tasks: Create a vector of dog breeds Allow the user to enter in various types of dog breeds that they are interested in, adding them to the vector until they are finished. Create and array of 5 Dogs. e Use your overloaded extraction operator to get data from the user to create dogs in your array. Create a function called findDogs0 that accepts the vector and the array. The function will compare the type of breeds the user requested (in the vector) to the current dogs in the array. overload the operator so that it compares the breed to the dogs in the array. Using your overloaded insertion operator display the dogs that match the breeds that the user is interested in. Set the adoption fee to 100.00 Dynamically create a single dog. Use your accessor and mutator functions to assign and display the values of your single dog. De-allocate the dynamic memory to remove your dog.

Explanation / Answer

#include <iostream>

#include <string>

#include <vector>

using namespace std;

class Dog

{

string name;

string breed;

double weight;

int kennel_number;

static double adoption_fee;

public:

Dog()

{

name = "Spot";

breed = "mutt";

weight = 50.5;

kennel_number = 1;

}

Dog(string br, double wt, int knum, string nm="Rower")

{

name = nm;

breed = br;

weight = wt;

kennel_number = knum;

}

};

double Dog::adoption_fee = 50.00;

int main()

{

vector<Dog> v;

Dog arr[5];

for(int i=0; i<5; i++)

{

string name, breed;

double weight;

int knum;

cout << "Enter dog name " ;

cin >> name;

cout << "Enter breed name ";

cin >> breed;

cout << "Enter weight ";

cin >> weight;

cout << "Enter kennel number ";

cin >> kum;

Dog[i] = Dog(breed, weight, knum, name);

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote