I am a noob programmer. I had a class in regular C programming that didn't prepare me for my C++ programming class. So my knowledge of programming is very limited. With that said, I've got an assginment here that I've started and have no idea how to complete. I was hoping that someone here could make this program. I know what you're thinking: How is that going to help you learn and why should I do it. As to the learning part, I really need to see what this program would look like to learn anything about it. Well, do with this what you'd like:



**************************************************
DESCRIPTION

1.1
Write a program that uses a class.

1.2
Your project will contain files CTime.h, CTime.cpp and TimeApp.cpp.

1.2.1 (Class declaration)

* Place the class declaration and inline functions in a seperate header file, CTime.h.

* Class declaration:

declare CTime as a class
public:

declare a defualt constructor
define an inline destructor with an empty code body
declare getHours as a member function
declare getMinutes as a member function
declare getSeconds as a member function
declare setHours, setMinutes, setSeconds as a member function
declare add as a member function with CTime return and a CTime parameter

private:

declare hours, minutes and seconds as an integer

make the constructor, destructor, get- and set- functions inline.

1.2.2 (Implementation CTime.cpp)

* #include file CTime.h

* place the noninline member function add in a separate file, CTime.cpp

-convert the time values to total seconds before adding them
example:
CTime tm;
long t1Seconds;
t1Seconds = (long)tm.hours*3600 + tm.minutes*60 + tm.seconds;
-add the total seconds together:
t3Seconds = t1Seconds + t2Seconds;
-divide them back out to make the new time hours, minutes and seconds.
- store them in a class CTime variable before returning it.

1.2.3 (member function add)

Module add

Return: CTime

Paramaters: define t2 as a CTime

Data:
define t1Seconds, t2Seconds and t3Seconds as long integers
Processing:

convert hours, minutes and seconds to a long and assign to
t1Seconds

convert t2.hours, t2.minutes and t2.seconds toa long and assign to t2Seconds

SET t3Seconds to t1Seconds + t2Seconds

derive values from t3Seconds to assign to temp.hours, temp.minutes and temp.seconds

return temp

END add

1.2.4 (Application file TimApp.cpp)

this is where the prgoram asks the user for 2 times entered in this format:

12:59:59

the program adds the 2 times and displays the sum


Here's the code I've done:


CTime.h file:

Code:
/******************************* FILE: CTime.h* PROGRAMMER: * DATE: 01/14/09** Declaration of class CTime.*******************************/#ifndef CTime_H#define CTime_H    #include <iostream.h>    class   CTime     {    public:           CTime();           ~CTime()  {}                 int getHours();           int getMinutes();           int getSeconds();           int add();                 void setHours();           void setMinutes();           void setSeconds();                          private:            int hours;            int minutes;            int seconds;    };        inline int CTime::getHours()    {      return hours;         }    inline int CTime::getMinutes()    {      return minutes;        }    inline int CTime::getSeconds()    {      return seconds;        }    inline int CTime::add(CTime)    {      return CTime    }    inline void CTime::setHours(int hr)    {      hours = hr;              }    inline void CTime::setMinutes(int min)    {      minutes = min;             }    inline void CTime::setSeconds(int sec)    {      seconds = sec;             }        #endif
and here's CTime.cpp
Code:
/******************************
* FILE: CTime.cpp
* PROGRAMMER: 
* DATE: 01-14-09
*
* Implementation of class CTime.
*******************************/
#include "CTime.h"
#include <iostream>using namespace std;int main(int argc, char *argv[])
{
    int t1Seconds;
    int t2Seconds;
    int t3Seconds;
    
    int CTime::time()
    {
        t1Seconds = (long)time.hours*3600 + time.minutes*60 + time.seconds;
    
    
                 
    system("PAUSE");
    return EXIT_SUCCESS;
}