extClockType - else cout<<"In printTime Invalid...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include "extClockType.h" # using namespace std; u void extClockType::setTime(int zone, int hours, int minutes, int seconds) { clockType::setTime(hours, minutes, seconds); if(-12 <= zone && zone <= 12) zone_num = zone; else cout << "In setTime(): Invalid time zone. Time zone should be a number from -12 to 12." << endl; } void extClockType::getTime(int& zone, int& hours, int& minutes, int& seconds) { clockType::getTime(hours, minutes, seconds); zone = zone_num; } void extClockType::getZone(int& zone) { zone = zone_num; } void extClockType::printTime() const { clockType::printTime(); if(-12 <= zone_num && zone_num < 0) cout <<" UTC" <<zone_num << endl; else if (0 <= zone_num && zone_num <= 12) cout <<" UTC+" <<zone_num << endl;
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: else cout << "In printTime(): Invalid time zone. Time zone should be a number from -12 to 12. Exit."<< endl; } bool extClockType::equalTime(extClockType& otherClock) { int hours, other_hours; int mins, other_mins; int secs, other_secs; int zone, other_zone; getTime(zone, hours, mins, secs); otherClock.getTime(other_zone, other_hours, other_mins, other_secs); return(zone == other_zone && hours == other_hours && mins == other_mins && secs == other_secs); } extClockType::extClockType(int zone,int hours, int minutes, int seconds) { setTime(zone,hours, minutes, seconds); } extClockType::extClockType() //default constructor { setTime(0, 0, 0, 0); }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern