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

MINDTAP Inheritance and Composition In C++ (Example 1) a Due on Tfomorrow at 115

ID: 3722133 • Letter: M

Question

MINDTAP Inheritance and Composition In C++ (Example 1) a Due on Tfomorrow at 1159 PM EST dlockType... lock extClockype.. extlocky I main.c Inheritance and Composition 1 /Inplenentation FLle for the class clockType 3 #include dastrean» In Chapter 10, the class clocktype was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone Derive the class extclockType from the include "clockType.h 6 using nanespace std: 8 votd clockType: :setTine(int hours, int ninutes, int seconds) hours 24) I lass cleckType by addinga meer uf(ea hours variable to store the time zone. Add the necessary member functions and constructors to make the class functional, Also, write the definitions of the member functions and the constructors hr hours; 12else 13 14 hr93 16 17 else 18 19 20 if Ce seconds && seconds60) 21 22 else 23 24 ) 25 inminutes; sec seconds; sec: Run Code Test Grade 9.612 2 MacBook Air

Explanation / Answer

/* C++ class extClockType which is a derived class of clockType containing a member variable of type string to store the timezone */

class extClockType : public clockType

{

            private:

                        string timeZone;

            public:

// default constructor

                        extClockType() : clockType()

                        {

                                    timeZone = ""; // set timezone to empty string

                        }

// parameterized constructor to set the time and timezone

                        extClockType(int hours, int minutes, int seconds, string timeZone): clockType(hours,minutes,seconds)

                        {

                                    extClockType::timeZone = timeZone;

                        }

// function to set the time zone

                        void setTimeZone(string timeZone)

                        {

                                    extClockType::timeZone = timeZone;

                        }

// function to get the timezone

                        string getTimeZone()

                        {

                                    return timeZone;

                        }

}; // end of extClockType class