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:
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.
earlier
to date.h
.
date.cpp
contains no errors. You will have
errors in the other files, but this should not.
#ifndef
lines to appointments.h
and
appropriate includes. Do not make changes to the
classes Appointment
and Schedule
.
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.
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...
main.cpp
.
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.
main.cpp
with the new version.
.cpp
file (except
main.cpp
) and select Add filename to CMake
Project