Question
Can you all fix this, if so ASAP would be great? Below is what I gave everyone for main and extClockType.h. Both of these codes
Can you all fix this, if so "ASAP" would be great?
Below is what I gave everyone for main and extClockType.h. Both of these codes need to be put in main() and extClockType.h.
You are needing to write the code for extClockTypeImp.cpp and then put this in extClockTypeImp.cpp
// main() code below. This code will need to be put in main.
//Program that uses the class extClockType
#include
#include "extClockType.h"
using namespace std;
int main()
{
extClockType time1(5, 10, 34, "CST");
extClockType time2;
cout << "Time 1: ";
time1.printTime();
cout << endl;
time2.setTime(12, 45, 59, "PST");
cout << "Time 2: ";
time2.printTime();
cout << endl;
time2.incrementSeconds();
cout << "After incrementing time2 by one second, Time 2: ";
time2.printTime();
cout << endl;
return 0;
}//end main
Code for extClockType.h
#ifndef H_ExtClockType
#define H_ExtClockType
#include
#include "clockType.h"
using namespace std;
class extClockType: public clockType
{
public:
void setTime(int hours, int minutes, int seconds, string tZone);
void printTime();
extClockType(int = 0, int = 0, int = 0, string = "EST");
private:
string timeZone;
};
#endif
The code that you need to write and put in extClockTypeimp.cpp should look something like below
#include
#include
#include "extClockType.h"
using namespace std;
void extClockType::setTime(int hours, int minutes,
int seconds, string tZone)
{
clockType::setTime(hours, minutes, seconds);
timeZone = tZone;
}
void extClockType::printTime()
{
clockType::printTime();
cout << " " << timeZone;
}
extClockType::extClockType(int hours, int minutes,
int seconds, string tZone)
:clockType(hours, minutes, seconds)
{
timeZone = tZone;
}
I hope this helps.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started