CSC 2210, SPA 3:
Appointments

Program Description

For this SPA you will complete a program to read appointments and print them out in sorted order where appointments are sorted (ordered) by date. The goal of the SPA is to get experience with C++ header and implementation files and separating method and function definitions from their declarations.

You do not have to know any algorithms for putting data in order ("sorting") to do this assignment. Schedule::add implements a simple algorithm known as insertion sort in which the code determines where to place each new item in a collection and then shifts the remaining items right one position to allow the new item to be inserted. This does not scale, but you will learn more effective algorithms in later courses.

To complete this assignment, do the following:

  1. Create a project and add the following files to it:
  2. Add class Date to date.h, using date.cpp to see what methods and attributes are needed. Note that the definitions of all methods will be in date.cpp - all you need to include in date.h are the prototypes. Ensure the data (_month, _day, and _year) is private and that the public interface appears before the private section. Class Date will depend on std::string, so be sure to add the appropriate #include.

    Do not put using namespace std; in date.h. It is rare for a header file to have using declarations in it.

    Note that writing the prototypes for date.h should be straightforward: you can simply copy/paste the appropriate bits of code from date.cpp and make minor edits.

  3. Add a prototype for earlier to date.h.
  4. Check that date.cpp contains no errors. You will have errors in the other files, but this should not.
  5. Add the #ifndef lines to appointments.h and appropriate includes. Do not make changes to the classes Appointment and Schedule.
  6. Comment out the incomplete while in appointments.cpp At this point, the entire system should be free of compilation errors. The program will not compile - you still need to define methods and functions in appointments.cpp, but there should be no unrecognized symbols.
  7. Complete all directions marked by TODO. You can leave the TODOs in your code if you want; I find they are helpful when double-checking that everything is complete.
  8. Build your solution and run it on test1. The output should be
            05/29/2016: boredom.begin():  start of summer break
            11/24/2016: eat turkey
            11/28/2016: start winter 16-17
            12/21/2016: break for Christmas!
            03/06/2017: spring quarter starts in 2017
            03/14/2017: pi!
            03/05/2018: start of last term for seniors...
    
  9. Use the search feature of your IDE to confirm that all TODO instructions have been completed.
  10. Ensure your code meets the coding standard.
  11. Submit your solution as directed below. NOTE: this is an assignment where getting your code to compile is half the challenge. You can get 40% for this assignment just by getting your code to compile with main.cpp.

Submitting

Do not submit main.cpp - the handin system is set up to automatically include that with your solution when it builds. Use the esubmit tool, add each of your source files in any order (appointments.h, appointments.cpp, date.h, and date.cpp), and click on the Submit button. When you are finished with the code, submit a document to Canvas as directed.

Possible Issues