Course List: http://www.c-jump.com/bcc/

Assignment a9: Serial date class


  1. Assignment Description
  2. Coding requirements
  3. How to Submit

1. Assignment Description


  1. Create a new project. Add SDate_main.cpp (download ) to the list of source files in your project. This file contains the main() test driver program.

  2. Create a new header file, serial_functions.h (download ) and a new source
    file serial_functions.cpp (download )

  3. Add serial_functions.cpp to the list of source files in your project.

  4. Open serial_functions.cpp, then copy and paste definitions of the corresponding functions that you wrote while working on the Serial Julian Date homework.

  5. Take a look at the header guards in serial_functions.h. The declarations of the serial date functions are placed between those guards.

  6. You also need SDate.h (download) header which declares new class SDate.

  7. Your assignment is to finish the SDate implementation. Add a new source file named SDate.cpp to the project and write the code for SDate member functions in this file.

  8. You should start by adding the member function definitions. For example,

    
    void SDate::serial( int sDate )
    {
        // Implementation code goes here
    }
    
    

    Notice how the member function name is prefixed by the name of the class and a double colon (highlighted). The double colon is the C++ scope resolution operator. It tells the compiler that the function SDate::serial() belongs to the scope of class SDate.

     


2. Coding requirements


  1. Store only one integer in your SDate class - the value of the computed serial date.

  2. When writing your implementation, call existing serial date functions to perform all low-level serial Julian date computations.

  3. If bad parameters are detected by the set() member function, do not update the current serial date value -- simply return false. Do not print any error messages from your set() member function, let the caller deal with the problem.

  4. Compile and test your class implementation against the main() function provided
    in SDate_main.cpp.

     


3. How to Submit