Project 1
Spring 2011
Due: Feb 9 @ 5 PM
6 points
In this project, you will use classes and object composition to implement software that stores and processes students on a wait list for another type of class, such as COSC-071. 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 the wait-list information from the file waitlist.in, storing it in the Waitlist object. main should use the first command-line argument as an integer to nominate the top students on the wait list, remove them from the wait list, and print them to the console. It should then write the modified wait list to the file waitlist.out.
Each record of waitlist.in has four fields: a name delimited with double quotes, a major consisting of a four-character string, a level, which can be FY, SO, JR, or SR, and a Date indicating the date the student appear on the wait list. Examples of records in this format are:
"Marcus A. Maloof" ENGL FY 1/16/2011 "Clay Shields" STIA JR 1/15/2011 "Mark Maloof" COSC SR 1/14/2011
The first thing you should do is implement the Date class, which you will use to store the date that a student appears on the wait list. The set methods must perform data-integrity checks and should fail silently, meaning that if a parameter is invalid or out of range, 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 operators for determining whether dates are before, equal to, and after one another. 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 Student class, which consists of a name, major, level, and date. 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 Waitlist class, which is simply a vector of Waitlist objects. In addition to methods for reading and writing students on the wait list to and from streams, there is a method that nominates and removes a specified number of students from the waitlist.
Getting Started
Although you may use any development environment for your project, it must compile and execute on seva. Make sure it compiles and runs without error before submitting.
Place all of your code in a subdirectory named p1. To create this subdirectory, type
seva% mkdir p1To descend into the directory, type
seva% cd p1All of the files for your project should be in this directory.
For convenience, I have placed an input files on seva, waitlist.in. To retrieve this file, type:
seva% cp ~maloofm/cosc072/waitlist.in ./ seva% ls waitlist.inThese commands create a new directory named p1, descends into that directory, copies all of the file waitlist.in extension from my cosc072 directory to your current directory (./), and lists the file showing that it was copied correctly.
You must provide a working Unix Makefile with your submission. Start with this Makefile, which compiles a project consisting of main and date. You can copy it from my directory into your current directory on seva using the commands:
seva% cp ~maloofm/cosc072/Makefile ./If you're coding on a Windows machine, you will need to edit the Makefile and change the .cc extension to .cpp.
If you want to copy files from the hw1 directory to the p1 directory, assuming you're in the p1 directory, to copy main.cc, type:
seva% cp ../hw1/main.cc ./You can do the same for other files and edit them, rather than typing them from scratch.
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. */
Instructions for Electronic Submission
You'll be submitting p1 exactly like you submitted hw1. If you need to include a message to your TA about your submission, then place the message in a file named README. Place the README file in the project's directory.
Assuming all of your code is in the subdirectory p1, directory, this directory and the submit program should be in the same directory:
seva% ls p1/ submit.jar
To reduce the size of the zip file, before submitting, remove all object and executable files:
seva% cd p1 seva% make clean
If you need to include a message to your TA or me about your submission, then place the message in a file named README. Place the README file in the project's directory.
To move from the p1 directory to the parent directory, type
seva% cd ..At this point, you should be above the p1 directory:
seva% ls p1/ submit.jar
(Additional useful Unix commands)
When you are ready to submit, change the name of the directory to your netid. For example, if your netid is maloofm, then rename the directory p1 by typing
seva% mv p1 maloofmCreate a zip file of the directory and its contents by typing
seva% zip -r p1.zip maloofm/*This command creates a zip file named p1.zip by recursively (-r) copying all of the files (*) from the directory maloofm/.
To submit the zip file type
seva% java -jar submit.jar -a p1 -f p1.zipp1 is the name of the assignment (-a) and p1.zip is the file (-f) to be submitted for that assignment.
If the program submits the file successfully, you will receive a receipt by e-mail at the address <netid>@georgetown.edu.
Submit your project only once.
Once you've submitted your project, it is important to keep an electronic copy on a university machine (e.g., seva) 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.
You can also change the directory's name back to the original name. For example,
seva% mv maloofm p1Note that changing the name of the directory does not change the dates of the files in the directory. You can also remove the zip file from your directory:
seva% rm p1.zip
The TA who will be grading your projects this semester is listed on the main page. You must submit your project before 5 PM on the due date.