Start New Discussion within our Software Development Community

Hi guys..
I've started but don't know what to do next.. can someone please help.

This is the question..

Q:- Write a program to define a class to implement the time of day. A clock gives the time of day, let us call this class ClockType. Furthermore, to represent the time in computer memory, use there int variables: one to represent the hours (i.e. hr), one to represent the minutes (i.e min) and one to represent the seconds (i.e. sec) and perform the following operations

1. setTime function with three parameters to validate the followings
a. hours should be in the range 0-23 otherwise make it 0
b. minutes should be in the range 0-59 otherwise make it 0
c. second should be in the range 0-59 otherwise make it 0
2. printTime function to print the time
3. incrementSeconds to increment the time by one second
4. incrementMinutes to increment the time by one minute
5. incrementHour to increment the time by one hour
Write application to use ClockType class and all its member functions
Note:
The time is going to be printed in the following formate: hh:mm:ss (e.g. 10:04:30)


This is my starting..

# include <iostream>
using namespace std;

class ClockType 
{
	
public:

	const ClockType ();

	void setTime (int hours, int minutes, int seconds);

	void printTime ();

	int incrementSeconds (int second);

	int incrementMinutes (int minutes);

	int incrementHour (int hours);

private:

	int hr, sec, min;

};


int main ()
{


return 0;
}

How do I fill them?

I also don't know wethere user is going to enter the time or not.. I mean am i going to prompt him to enter any cin or not :s

This article has been dead for over six months. Start a new discussion instead.