Question: Convert a structure into a class implementation. Details: . Start with the repl code provided to you Modify all of the functions so that they

 Convert a structure into a class implementation. Details: . Start with
the repl code provided to you Modify all of the functions so
that they are member functions. Use the scope resolution operator (:) to
show that an implementation of a function is part of a class
Change the initialization function into a constructor with arguments. Add a default

Convert a structure into a class implementation. Details: . Start with the repl code provided to you Modify all of the functions so that they are member functions. Use the scope resolution operator (:) to show that an implementation of a function is part of a class Change the initialization function into a constructor with arguments. Add a default constructor that initializes things to 0 or empty string. Please note that you should use a for loop to initialize all the values of furColours Add one getter to return the furclassification . Modify the calls in main to reflect the change in the functions. Be sure to add the keyword const after functions that do not change the data . If you want, you can turn the istaller function into an overloaded operator> Here are two sample runs that you can try in the lab: hercules [5] 1 ./main Please describe the cat Please enter a length: 48 Please enter a height: 25 Please enter a tail length: 31 Please enter an eye colour blue Please enter a description of the Eur (long, medium, short, none): short Please enter the colours of the fur (separated by space or a newline character). Add done" at the endi grey white done The average cat has medium fur This is myCat Length: 48 Height: 25 Tail Length: 31 Hye Colour: blue Pur. Classification short cat Colours grey white My cat is taller than the average cat hercules [6] hercules/611 ./main Please describe the cat Please enter a length: 44 Please enter a height: 22 Please enter a tail length: 30 Please enter an eye colour: yellow Please enter a description of the fur (long, medium, short, none): long Please enter the colours of the fur (separated by a space or a newline Jeharacter). Add done" at the end: black white orange done The average cat has medium fur This is myCat: Length: 44 Height: 22 Tail Length: 30 Eye Colour: yellow Fur Classification: long Cat Colours: black white orange My cat is shorter than the average cat My cat is a calico // Filename: main.cpp // Purpose: To convert a structure into a class implementation. #include "Cat.h" #include using namespace std; int main() { Cat averageCat, myCat; string colours[5]; colours[0] = "orange"; colours[1] = ""; initCat (averageCat, 45, 24, 28, "green", "medium", colours); readCat (myCat); cout using namespace std; struct Cat { double length; double height; double tailLength; string eyeColour; string furClassification; //long, medium, short, none string furColours[5]; }; void initCat (Cat&, double, double, double, string, string, const string[]); void readCat (Cat&); void printCat (const Cat&); bool isCalico (const Cat&); bool isTaller (const Cat&, const Cat&); #endif #include "Cat.h" #include using namespace std; void initCat (Cat& cat, double I, double h, double tl, string ec, string fcl,const string furColli) { int i = 0; cat.length = 1; cat.height = h; cat.tailLength = tu; cat.eyeColour = eC; cat.furClassification = fc1;//long, medium, short, none while (furCol[i] != "") { cat.furColours[i] = furColli); i++; } cat.furColours[i] = ""; } void readCat (Cat& cat) { int i = 0; cout > cat.length; cout > cat_height; cout > cat.tailLength; cout > cat.eyeColour; cout > cat.furClassification; cout > cat.furColours[i]; while (cat.furColours[i] != "done") { cin >> cat.furColours[i]; while (cat.furColours[i] != "done") { cin >> cat.furColours[i]; } cat.furColours[i] = ""; void printCat (const Cat& cat) { int i = 0; cout cat2.height); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!