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

For this problem, you will design and implement 2 classes and then write a drive

ID: 3658236 • Letter: F

Question

For this problem, you will design and implement 2 classes and then write a driver function to test these classes. The first will be a C++ class for an abstract data type color with a public enumeration type colorType that has the color values shown in Listing 10.8. Your abstract data type should have an attribute for storing a single value of type colortype and member functions for reading (readColor) and writing (writeColor) a color value as well as setting and accessing it. The function readColor should read a color as a string and store the corresponding color value in the value attribute of a type color object. The function writeColor should display as a string the value stored in the value attribute of a type color object (see Figure 7.5). Modify class circle and the driver function in Listing 10.9 to include and use this class. You

Explanation / Answer

//color.h //Color class definition #ifndef COLOR_H #define COLOR_H class color { public: enum colorType {black, blue, green, cyan, red, magenta, brown, lightgray, nocolor}; //Member functions //read color in void readColor (color); //write color out void writeColor (color); //accessor functions color getColor() const; private: //data members color cColor; }; #endif // File color.cpp // Color class implementation #include "color.h" #include using namespace std; // Member Functions... // Set color void color::readColor(color c) { cColor = c; } void color::writeColor() const { cout
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