0% found this document useful (0 votes)
105 views

Sethour (Int Hour) Setminute (Int Min), Setsecond (Int Sec)

This document discusses creating a class called time with member functions to set and get the hour, minute, and second. It should check for invalid parameters and throw exceptions. A pointer to a time object should output its values. The time class could utilize the time.h header to set default system time. A date class could inherit from time, with member functions that use the time fields from the base class. Conditions should check for leap years and throw exceptions.

Uploaded by

Himanshu Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views

Sethour (Int Hour) Setminute (Int Min), Setsecond (Int Sec)

This document discusses creating a class called time with member functions to set and get the hour, minute, and second. It should check for invalid parameters and throw exceptions. A pointer to a time object should output its values. The time class could utilize the time.h header to set default system time. A date class could inherit from time, with member functions that use the time fields from the base class. Conditions should check for leap years and throw exceptions.

Uploaded by

Himanshu Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASSIGNMENTS USING CLASSES AND OBJECTS

-> create a class/object for time


-> it should have member functions
-> sethour(int hour)setminute(int min) ,
setsecond(int sec)
-> which should check and throw an exception when
invalid parameters are entered.
-> it should also have member functions like
gethour() , getminute() , getsecond() for outputting
any of the time fields at a particular instant.
-> also utilise pointer to a object to output values to
possible extent.
-> also try to take default system time using
time.h(headers) and inbuilt structures such as time_t and
its fields if default constructors were invoked by calling
without arguments in main.
-> also try to inherit this base class time to derived class
date which will affect relevant fields of date class.
-> relevant extra member functions in date should be
used such that they inturn use the time got from their
respective base classes.
-> here importantly conditions need to utilized
properly(on member variables) so that exceptions are
raised (thrown) and caught such that it gives a replica of
leap year also.

You might also like