homework help

So I haven't touched C++ in a year and a half now and I don't remember much but i'm in this class and this professor wants this from me:
"Lucy Brat complains that clockType only handles hours, minutes, and seconds. Write a derived class with the clickType class as a base class. Your class should inherit from clicktype.h and modify it as described below. In every case there should be at least one public member function to display the private memeber data items and one to fill memeber items wit ha vaule. There should also be two constructors. Save the class followed by .h"


My job is to "Add code to include months. Should be between 0 and 11"

This is clocktype.h he gave us:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class clockType
{
public:
    void setTime(int hours, int minutes, int seconds);
		//Function to set the time
		//The time is set according to the parameters
		//Postcondition: hr = hours; min = minutes; 
	   	 //               sec = seconds
 		//  The function checks whether the values of hours, , 
 		//  minutes and seconds are valid. If a value is invalid, 
 		//  the default value 0 is assigned.
    void getTime(int& hours, int& minutes, int& seconds);
		//Function to return the time
		//Postcondition: hours = hr; minutes = min;
		//	           seconds = sec
    void printTime() const;
		//Function to print the time
 		//Postcondition: Time is printed in the form hh:mm:ss
    void incrementSeconds();
		//Function to increment the time by one second.
		//Postcondition: The time is incremented by one second
		//  If the before-increment time is 23:59:59, the time
 		//  is reset to 00:00:00.
    void incrementMinutes();
		//Function to increment the time by one minute.
		//Postcondition: The time is incremented by one minute 
		//  If the before-increment time is 23:59:53, the time
  		//  is reset to 00:00:53.
    void incrementHours();
		//Function to increment the time by one hour.
		//Postcondition: The time is incremented by one hour 
		//  If the before-increment time is 23:45:53, the time 
		//  is reset to 00:45:53.
bool equalTime(const clockType& otherClock) const;
		//Function to compare the two times.
		//Postcondition: Returns true if this time is equal to
		//               otherClock; otherwise, returns false
clockType(int hours, int minutes, int seconds);
		//Constructor with parameters 
		//The time is set according to the parameters.
		//Postconditions: hr = hours; min = minutes; 
		//                sec = seconds
 		//  The constructor checks whether the values of hours, 
 		//  minutes, and seconds are valid. If a value is invalid, 
 		//  the default value 0 is assigned.
    clockType();
		//Default constructor with parameters 
 		//The time is set to 00:00:00.
		//Postcondition: hr = 0; min = 0; sec = 0
private:
    int hr;  //stores the hours
    int min; //stores the minutes
    int sec; //stores the seconds
};


This is what I got so far:
1
2
3
4
5
6
#include "clocktype.h"
class monthType : public clockType
{
public:
	monthType(int months)


idk what i'm doing and need some help thanks guys
Think about the big picture first: you have a class for dealing with time, but the only units it supports directly are hours, minutes, and seconds. Your new class will be identical except that it will add additional units, specifically months.

I don't think "monthType" is a good name, considering that the original class is not named "hoursMinutesSecondsType". Perhaps consider "calendarType"?

Also, you should get familiar with how to use clockType, as the additions you make will need to be consistent.
Do you still need help? If so, send me a private message.
toomanystars wrote:
Do you still need help? If so, send me a private message.
http://www.cplusplus.com/forum/beginner/1988/5/#msg20048
Duoas wrote:
What, so you can decide who gets to understand and who doesn't?
Topic archived. No new replies allowed.