COSC 072: Computer Science II

Project 1
Summer 2010

Due: Thu, Jul 22 @ 10 PM
6 points

In this project, you will use classes and object composition to implement software that stores checkbook information. (Does anyone have a checkbook these days?) I have produced a design document for the classes and methods you need to implement for this project.

To demonstrate your classes, the main function should read checkbook information from the file checkbook.dta, storing it in the Checkbook object. main should then output the checks of the checkbook to the console and print the total amount of the checks.

Each record of checkbook.dta has three fields separated by white space: a Date indicating the date of the check, a double indicating the amount of the check, and a string that may contain spaces that ends at the end of line indicating the payee. Examples of checks in this format are as follows:

7/01/2010 25.00 Tombs
7/10/2010 2.67 Uncommon Grounds
7/2/2010 7.85 Epicurious
7/06/2010 45.67 Safeway
7/10/2010 6.35 Wisemillers
7/10/2010 3.45 Starbucks

The first thing you should do is implement the Date class, which you will use to store the date that a check was written. The set method must do data-integrity checks and should fail silently, meaning that if a parameter is invalid or out of bounds, then the set method does not replace the existing value. In addition to providing methods for reading and writing Date objects to and from streams, you will also need to implement the relational operations before, equal, and after. Finally, you must overload the stream insertion and stream extraction operators. Implement this class completely and thoroughly test it before implementing the next class.

After you have implemented the Date class, turn your attention to the Check class, which consists of a date, an amount, and a payee. In addition to methods for reading and writing to and from streams, you will need to overload the stream insertion and extraction operators. Implement this class completely and thoroughly test it before implementing the next class.

Finally, implement the Checkbook class, which is simply a vector of Check objects. In addition to methods for reading and writing events of a checkbook to and from streams, there is a method that returns the total amount of the checks in the checkbook.

Instructions for Electronic Submission

At the top of the file main.cc (or the file containing the main function), place the following header comment, with the appropriate substitutions:

/*
 * COSC 072 Project 1
 * Name: <your name>
 * ID: <GoCard ID>
 * E-mail: <e-mail address>
 * Instructor: Maloof
 *
 * 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.
 */

You'll be submitting p1 exactly like you submitted hw1. If you need to include a message about your submission, then place the message in a file named README. Place the README file in the project's directory. Just zip it up and submit it via Blackboard.

Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.