In this project, you will use classes and object composition to implement software that synchronizes events of a
calendar between two devices, such as between a computer and an iPhone. UML diagrams for the classes that
must be implemented can be found at the end of this document. For much more information about these classes
refer to: http://people.cs.georgetown.edu/~maloof/cosc052.s19/p1docs/index.html
To demonstrate your classes, the main function should take two input files from the command line, synchronize
the calendar events in those files, and write the synchronized set of events to two output files. Function main
shall catch invalid_argument exceptions, logic_error exceptions, and unknown exceptions. If an
exception occurs, the program shall output a descriptive message to the user and continue processing or terminate
Since we are faking this (not implementing on real devices with real calendars), input files will have the extension
.in and output files will have the extension .out. For example, the command
cs-class% ./a.out computer iphone
should read the events in the files computer.in and iphone.in, synchronize the events, and write the
synchronized events to computer.out and iphone.out.
The data format for these files consists of seven tab-separated fields: a character indicating the status of the
record (A for active or D for deleted), a string that is the unique identifier of the event, a string delimited with
double quotes that is the name of the event, a string delimited with double quotes that is the location of the
event, a date and time indicating the start of the event, a date and time indicating the end of the event, and a date
and time indicating the event’s last date of modification. Two examples of events in this format are as follows:
The first thing you should do is implement the DateTime class, which you will use to store the start, end, and
modification dates and times for events. The setter methods must do data-integrity checks and should throw an
appropriate exception without modifying corresponding private data member’s current value. In addition to
providing methods for reading and writing DateTime objects to and from streams, you will also need to overload
the equality and relational operators so you can determine if two dates are equal or if one date occurs before
another. Implement this class completely and thoroughly test it before implementing the next class.
After you have implemented the DateTime class, turn your attention to the Event class, which consists of a
status, an event identifier, a name, a location, a start time, an end time, and a modification time, as described
previously. In addition to methods for reading and writing to and from streams, you will need to overload the
equality and relational operators. The equality operators should determine if two events are equal based on their
unique identifiers. The relational operators should determine if one event is earlier or later than some other.
Implement this class completely and thoroughly test it before implementing the next class.
Finally, implement the Calendar class, which is simply a vector of Event objects. In addition to methods for
reading and writing events of a calendar to and from streams, the primary methods of the class synchronize the
A 93B3FFC2-CC21-4457-918E-C04E4D9BFB6F “Panel” “ICC Aud” 10/01/09 10:00 AM 10/01/09 01:00 PM 11/11/09 03:28 PM
A 851B0018-6AA7-4480-9F00-D85BB858C5BE “Ben” “” 10/01/09 04:15 PM 10/01/09 05:30 PM 11/11/09 03:28 PM
9 January 2019 Project #1
COSC 052 Spring 2019 Page 2 of 6
events of two calendars based on their modification dates. New events in one calendar should be copied to the
other. Events modified in one calendar should be updated in the other. Finally, events deleted on one device
should be deleted on the other. However, the delete operation in this case changes the status, but does not
physically remove the record, which is necessary for synchronizing multiple devices. We’ll talk about this in
Although you may use any development environment for your project, it must compile and execute on the class
server. Make sure it compiles and runs without error on cs-class before submitting to Autolab.
For convenience, several files are attached to the Project 1 Assignment on Canvas to help get you started. You
should create a directory on your server account named p1 and copy all of these files to that directory. Once that
is done, the p1 directory, will contain a Makefile and .cpp and .h files for the project. If you are developing
on an IDE, then do the same thing on your local computer and add the .cpp and .h files to your IDE project.
The files computer.in and iphone.in contain real events from Professor Maloof’s calendar, which provide
both the data for our project and a glimpse into the exciting life of computer science faculty members!
Although these files contain real events, instead of using these during the initial stages of development, I would
recommend creating your own data files in a simplified, minimal format. I would also recommend creating a
number of small data files for testing specific synchronization cases. For example, to test for the addition of a new
event, I would create one data file containing two events, and then create another data file with those same
events and one additional one. This will let you focus your testing with a smaller amount of data. Use the data
files that I have provided for your final testing once you have everything working.
This is an individual project and all work must be your own. Refer to the guidelines specified in the Academic
Honesty section of this course syllabus or contact me if you have any questions.
In a file named HONOR, include the following statement with the appropriate modifications:
In accordance with the class policies and Georgetown’s Honor Code,
I certify that, with the exceptions of the class resources and those
items noted below, I have neither given nor received any assistance
on this project.
9 January 2019 Project #1
COSC 052 Spring 2019 Page 3 of 6
Instructions for Electronic Submission
Your project must be submitted no later than Friday, February 1, 2019 at 5:00pm. Late submissions will be
penalized 1 point for each minute. In general requests for extensions will not be considered.
You will submit Project 1 in much the same way as you submitted Homework 1. Assuming all of your code is
in a subdirectory named p1 on the server, then you can type the following:
Notice the presence of the file submit.zip in the directory. Use a secure file-transfer program (sftp or FileZilla)
to transfer the zip file from cs-class to your laptop.
You can also produce this zip file on your laptop, but it is imperative that the zip file contains only the files of your
project with no subdirectories. To be sure please zip your files on the server.
To submit the zip file, use your browser to log on to Georgetown’s instance of Autolab
Navigate to the correct course and assignment, and submit your file.
You can submit to Autolab seven times. You can perform five compile checks, and you can perform two project
submissions that are automatically graded. The last automatically graded submission is the grade for the project.
If something goes wrong with Autolab, upload your zip file to Canvas.
Once you’ve submitted your project, it is important to keep an electronic copy on a university machine (e.g.,
cs-class) that preserves the modification date and time. If we lose your project or the submission system breaks,
then we will need to look at the modification date and time of your project to ensure that you submitted it before
it was due. Retain either the zip file or the directory containing your project’s files.
cs-class% cd p1
cs-class% make submit
rm -f submit.zip
zip submit.zip main.cpp calendar.cpp event.cpp datetime.cpp main.h calendar.h event.h
datetime.h Makefile HONOR
adding: main.cpp (deflated 61%)
adding: calendar.cpp (deflated 70%)
adding: event.cpp (deflated 73%)
adding: datetime.cpp (deflated 76%)
adding: main.h (deflated 29%)
adding: calendar.h (deflated 52%)
adding: event.h (deflated 63%)
adding: datetime.h (deflated 62%)
adding: Makefile (deflated 62%)
adding: HONOR (deflated 32%)
a.out* calendar.o datetime.h event.h main.cpp Makefile
calendar.cpp computer.in datetime.o event.o main.h submit.zip
calendar.h datetime.cpp event.cpp iphone.in main.o
9 January 2019 Project #1
COSC 052 Spring 2019 Page 4 of 6
This graded assignment is worth 100 points and will be counted as part of the Programming Projects category for
the course. Your final score is based on automated tests performed by AutoLab, as well as a manual review
conducted by me and one of our Teaching Assistants (TAs). We will talk about the AutoLab tests in class and you
will be able to see exactly what those are when you submit for the first time.
It is important to emphasize that the grade you obtain from Autolab is an initial grade and may not be your final
grade. There are many important aspects of a program that are difficult or impossible to assess using automatic
grading routines. For example, automatic grading routines cannot determine if you have written proper
documentation. They cannot easily assess if an implementation of an operation is optimally efficient. As a
consequence, The manual review of your project could result in deductions up to 100 points (although grades will
not be allowed to be negative).
The Autolab points are distributed as follows:
• 40: Compiles against the autograder
• 20: Executes without failure using the autograder
• 40: Autograder unit tests
Subsequent point deductions that could be made by me and/or the TA’s review include:
• 10: Internal documentation, if required
o Purpose of classes and methods explained in documentation comments
o Purpose, range, and meaning of identifiers explained, where needed
o Complex flow of control explained
• 10: Style and formatting
o Nested indentation for loops and conditionals
o All class, method, and function headers emphasized
o Comments set off from code
o Vertical alignment of comments, where appropriate
o White space between blocks of code (and comments)
o Mnemonic identifier names
• 80: Algorithm and Implementation
o Correct implementation of the operations
o Proper object-oriented design and implementation
o Appropriate error checking and diagnostic messages
o Appropriate data and object types
o Correct, clean, organized output format
Notice that an implementation consisting entirely method stubs would obtain an initial Autolab grade of 60. Such
an implementation is incomplete, and would certainly receive further deductions during the manual review.
In addition to the above, the following deductions may be taken if applicable:
• 20: Does not compile on cs-class
• 1–10: Incomplete or improper submission
• 1–5: My effort for fixing any minor issue
• 1–5: Inefficiently implemented routine
• 1 per minute: Late deduction
9 January 2019 Project #1
COSC 052 Spring 2019 Page 5 of 6
9 January 2019 Project #1
COSC 052 Spring 2019 Page 6 of 6
Course Materials Notice
The materials used in Georgetown University courses (“Course Materials”) generally represent the intellectual
property of course instructors which may not be disseminated or reproduced in any form for public distribution
(e.g., sale, exchange, etc.) without the written permission of the course instructor. Course Materials include all
written or electronic documents and materials, including syllabi, current and past examination questions/answers,
and presentations such as lectures, videos, PowerPoints, etc., provided by a course instructor. Course Materials
may only be used by students enrolled in the course for academic (course-related) purposes.
Published course readings (book chapters, articles, reports, etc.) available in Canvas are copyrighted material.
These works are made available to students through licensed databases or fair use. They are protected by
copyright law, and may not be further disseminated or reproduced in any form for distribution (e.g., uploading to
websites, sale, exchange, etc.) without permission of the copyright owner.
More information about intellectual property and copyright can be found here:
More information about computer acceptable use policy and intellectual property can be found here:
This document: Copyright © 2019 W. A. Woods. All Rights Reserved. This material may not be published,
broadcast, rewritten, or redistributed.
On-line documentation: Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be
published, broadcast, rewritten, or redistributed.