There are quite a few files for this lab assignment Zip them
Solution
In this program, you need to create time and date libraries in order to build a final calendar program. Don\'t get confused and go step by step:
1. Create time header file Time.h
2. Create date header file Date.h
3. Create the final calendar program by including these two header files
I\'ll show you how to create the header file for Time and make you understand the concept of how we create header files and work with them. Header files are a combination of 2 files: a .h and a .cpp file with same name. In this case, we will create 2 files: 1. Time.h and 2. Time.cpp.:
1. Create header file Time.h:
This file contains the class declaration. This includes declaration of data members as well as member functions. Please note that this file only contains declarations. All the definitions are included in .cpp file for this class.
Time.h code:
#define Time
 class Time{
 public:
 int hour;
 int minute;
 int second;
 Time();
 Time(int,int,int);
 void mutateHour(int);
 void mutateMinute(int);
 void mutateSecond(int);
 int accessHour();
 int accessMinute();
 int accessSecond();
 };
2. Create the file Time.cpp
As mentioned above, this file will contain the definitions of constructors and member functions of the class mentioned in the .h file.
Time.cpp code:
#include \"Time.h\"
 #define MAX_HOUR 23
 #define MAX_MINUTE 59
 #define MAX_SECOND 59
 Time::Time(){
     hour = 0;
     minute = 0;
     second = 0;
 }
Time::Time(int h, int m, int s){
     if(h<=MAX_HOUR)
     hour = h;
     else
     hour = 0;
     if(m<=MAX_MINUTE)
     minute = m;
     else
     minute = 0;
     if(s<=MAX_SECOND)
     second = s;
     else
     second = 0;
 }
 void Time::mutateHour(int h){
     if(h<=MAX_HOUR)
     hour = h;
     else
     hour = 0;
 }
 void Time::mutateMinute(int m){
     if(m<=MAX_MINUTE)
     minute = m;
     else
     minute = 0;
 }
 void Time::mutateSecond(int s){
     if(s<=MAX_SECOND)
     second = s;
     else
     second = 0;
 }
 int Time::accessHour(){
     return hour;
 }
 int Time::accessMinute(){
     return minute;
 }
 int Time::accessSecond(){
     return second;
 }
Now when you create the calender program, you simple have to include this header file at the top of the file with other includes as follows:
#include <iostream.h>
#include \"Time.h\"
And you will be able to use the Time class as any other class, as if you have declared and defined it in this calender.cpp only.
Use this information to make Date.h yourself and you will be able to understand how this works.


