READ ME Pets Breed Class Create a Breed class with the following: Member Variables Create the following private member variables, all of type std::string: species_ breed_name_ color_ Constructors Create a default constructor for Breed that sets its species_ to "Dog", breed_name_ to "Pug", and color_ to "Fawn". Create a non-default constructor that receives a std::string for species_, breed_name_, and color_; in that order. The values from the constructor should appropriately assign the member variables.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ Dont include a breed.cc file. Use only 4 files.

READ ME

Pets
Breed Class
Create a Breed class with the following:

Member Variables
Create the following private member variables, all of type std::string:

species_
breed_name_
color_
Constructors
Create a default constructor for Breed that sets its species_ to "Dog", breed_name_ to "Pug", and color_ to "Fawn".
Create a non-default constructor that receives a std::string for species_, breed_name_, and color_; in that order. The values from the constructor should appropriately assign the member variables.
Accessors and Mutators
Create accessors and mutators for all member variables, following the naming conventions covered in class. e.g. for species_, name the accessor Species, and the mutator SetSpecies.

Pet Class
Create a Pet class with the following:

Member Variables
Create the following private member variables:

std::string name_
Breed breed_
double weight_
Constructors
Create a default constructor for Pet that sets its name to "Doug" and weight to 15.6. The Breed object will automatically be created using its default constructor.

Create a non-default constructor that receives an std::string for name_, Breed for breed_, and a double for weight_ in that order. The values from the constructor should appropriately assign the member variables.

Create another non-default constructor that receives an std::string for name_, std::string species_, name_, and color_ for the Breed constructor, and double for weight_. The values from the constructor should appropriately assign the data members.

Accessors and Mutators
Create accessors and mutators for name_, breed_, and weight_. Please name the accessor for breed_ as GetBreed, to avoid conflicting with the constructor for the Breed class.

SetBreed overload
Create a function overload for SetBreed that accepts a species_, name_, and color_, all of type std::string, that will internally create a Breed object using the values provided and then assign it to the breed_ member variable.

Print
Create a member function called Print that returns void and does not take in any parameters. Using the member variables, this function should print out the name and weight of the Pet. It should also utilize accessors of the Breed class to get the species, breed name, and color.

Other instructions
Complete the main function as described. Place the Pet class in pet.h, and the Breed class in breed.h. Member functions that take more than ten lines or use complex constructs should have their function prototype in the respective .h header file and implementation in the respective cc implementation file.

main.cc file

#include <iostream>

    
    int main() {

    // = YOUR CODE HERE =

    // 1. Create a vector Pet objects called `pets`.

    // Don't forget to #include <vector> and "pet.h"

    // ==

    std::string name;

    std::string breed_name;

    std::string species;

    std::string color;

    double weight = 0.0;

    


    do {

    std::cout << "Please enter the pet's name (q to quit): ";

    std::getline(std::cin, name);

    if (name != "q") {

    std::cout << "Please enter the pet's species: ";

    std::getline(std::cin, species);

    std::cout << "Please enter the pet's breed: ";

    std::getline(std::cin, breed_name);

    std::cout << "Please enter the pet's color: ";

    std::getline(std::cin, color);

    std::cout << "Please enter the pet's weight (lbs): ";

    std::cin >> weight;

    std::cin.ignore();

    


    // = YOUR CODE HERE =

    // 2. Create a Pet object using the input from the user

    // Store the newly-created Pet object into the vector.

    // ==

    }

    } while (name != "q");

    


    std::cout << "Printing Pets:\n";

    // == YOUR CODE HERE ==

    // 3. Print information about each pet in the `pets`

    // vector by writing a loop to access each Pet object.

    // ==

    return0;

    }

pet.h file

#include <string>

    


    #include "breed.h"

    // = YOUR CODE HERE =

    // Write the Pet class here. Refer to the README for the member

    // variables, constructors, and member functions needed.

    //

    // Note: mark functions that do not modify the member variables

    // as const, by writing `const` after the parameter list.

    // Pass objects by const reference when appropriate.

    // Remember that std::string is an object!

    // ==

breed.h file

#include <string>

    // = YOUR CODE HERE =

    // Write the Breed class here. Refer to the README for the member

    // variables, constructors, and member functions needed.

    //

    // Note: you may define all functions inline in this file.

    

// ==

pet.cc file

#include "pet.h"

    


    #include <iomanip>

    #include <iostream>

    // == YOUR CODE HERE =

    // This implementation file (pet.cc) is where you should implement

    // the member functions declared in the header (pet.h), only

    // if you didn't implement them inline within pet.h.

    //

    // Remember to specify the name of the class with :: in this format:

    // <return type> MyClassName::MyFunction() {

    // ...

    // }

    // to tell the compiler that each function belongs to the Pet class.

    // =

Sample Output:
Please enter the pet's name (q to quit): AirBud
Please enter the pet's type: Dog
Please enter the pet's breed: Golden Retriever
Please enter the pet's color: Blonde
Please enter the pet's weight (lbs): 44.5
Please enter the pet's name (q to quit): Cookie
Please enter the pet's type: Dog
Please enter the pet's breed: English Bulldog
Please enter the pet's color: Brown & White
Please enter the pet's weight (lbs): 31.2
Please enter the pet's name (q to quit): q
Printing Pets:
Pet 1
Name: AirBud
Species: Dog
Breed: Golden Retriever
Color: Blonde
Weight: 44.5 lbs
Pet 2
Name: Cookie
Species: Dog
Breed: English Bulldog
Color: Brown & White
Weight: 31.2 lbs
Transcribed Image Text:Sample Output: Please enter the pet's name (q to quit): AirBud Please enter the pet's type: Dog Please enter the pet's breed: Golden Retriever Please enter the pet's color: Blonde Please enter the pet's weight (lbs): 44.5 Please enter the pet's name (q to quit): Cookie Please enter the pet's type: Dog Please enter the pet's breed: English Bulldog Please enter the pet's color: Brown & White Please enter the pet's weight (lbs): 31.2 Please enter the pet's name (q to quit): q Printing Pets: Pet 1 Name: AirBud Species: Dog Breed: Golden Retriever Color: Blonde Weight: 44.5 lbs Pet 2 Name: Cookie Species: Dog Breed: English Bulldog Color: Brown & White Weight: 31.2 lbs
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

get these errors

main.cc:59:33: error: no member named 'getSpecies' in 'Pet
std::cout << "Species: << pet.getSpecies() << std::endl;
main.cc:60:31: error: no member named 'getBreed' in 'Pet'
std::cout << "Breed: << pet.getBreed() << std::endl;
II
~~~
NNN
main.cc:61:31: error: no member named 'getColor' in 'Pet'
std::cout << "Color: " << pet.getColor() << std::endl;
3 errors generated.
NNN
Transcribed Image Text:main.cc:59:33: error: no member named 'getSpecies' in 'Pet std::cout << "Species: << pet.getSpecies() << std::endl; main.cc:60:31: error: no member named 'getBreed' in 'Pet' std::cout << "Breed: << pet.getBreed() << std::endl; II ~~~ NNN main.cc:61:31: error: no member named 'getColor' in 'Pet' std::cout << "Color: " << pet.getColor() << std::endl; 3 errors generated. NNN
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education