CISC220, Summer 2006, Project 1
Due: in one week
(11:55pm Wednesday 06/14/06)

Introduction

In this project, you will build a simple class to represent a person,
and test that class with fixed sized arrays of objects.

This should be a very easy project just to remind you of some things that should already be familiar from CISC181, but might be rusty if it has "been a while". We'll move on to more advanced material quickly, e.g. linked lists,etc. Don't get fancy in this project! Keep it simple!

Here's some things you will need to know though. If you aren't sure of any of these topics, come see me SOON!

Step 0: Look at the data files fiveNames.txt, tenNames.txt, twentyNames.txt

There is nothing to turn in for this step.

Look at the files in the directory http://www.udel.edu/CIS/220/pconrad/06J/work/proj/proj1. (You can also find these files on strauss in the directory /www/htdocs/CIS/220/pconrad/06J/work/proj/proj1). You'll see three data files containing fictional data called:

elevenNames.txt fiveNames.txt tenNames.txt

These three files contain data about fictional people, in the following comma separated format:

ssn,lastName,firstName,sex,city,state,zip,phone

For example

> more fiveNames.txt
678487999,Clements,Barry,M,Green Bay,WI,54304,(414)872-4415
682844351,Lasley,Johnny,M,Auburn,WA,98002,(206)776-6826
562977072,Brown,Deidre,F,Atlanta,GA,30350,(404)279-9326
762012803,Lake,Dario,M,Brooklyn,NY,11226,(718)771-8703
593966803,Hanson,Patricia,F,Colorado City,TX,79512,(915)228-7086
>

Your job in this step is to look at these data files and think about how you would represent each line in this file as a C++ object. That is, if you were going to have a class called Person_C to represent one line of this data file, what would be the private data members? What would the member functions be?

Here's how the rest of the project will proceed:

Detailed instructions will follow below. You should complete at least one step every day in order to stay on schedule and not fall behind in the course!

A Unix tip: mkdir -p

Oh one note—before going on, you should create a cisc220 directory under your home directory, and a proj1 directory under that. (Hopefully, you feel insulted that I'm even telling you this, because by now, you'd just automatically do that without even being told. In fact, if you already did it before even reading this, that's a very good sign!)

One tip that you might not have picked up before: you can create the directories and move into them in just two steps, by putting the -p flag on the mkdir command:

mkdir -p ~/cisc220/proj1
cd ~/cisc220/proj1

The -p means that the intermediate directory cisc220 will be automatically created if it doesn't already exist.

Now copy the files into your current directory with:

cp /www/htdocs/CIS/220/pconrad/06J/work/proj/proj1/*.txt .

A side note about these data files:

In a few days, I'll show you the program I wrote to generate this random data—it's actually pretty cool. It generates random data files with

Why the mismatch—1990 Census data for names, and 2000 data for population? It's what I could get. But that's beside the point. Let's get on with this project!

Step 1: Write the class definition
(Filename: person.h 10% , 20% complete when done)

A few reminders about class definitions:

Some requirements for this assignment:

Before going on to Step 2, you can try compiling your .h file by creating a dummy main program like the one shown here. This file is also on the web site in a file called proj1/dummyMain.cc. The idea is that while you can't compile the file person.h directly to check for syntax, you can compile "dummyMain.cc" and see if it compiles. If there are errors in person.h, they'll show up when you compile dummyMain.cc.

// dummyMain.cc   P. Conrad for CISC220, 06J
// Illustrate how to check a .h file for correct syntax


#include "person.h"

int main(void)
{
  return 0;
} 

Step 2: Write the member functions for the Person_C class
(Filenames: person.cc, 20% of total points, 40% complete when done)

Now write the file person.cc containing the member functions for the Person_C class. Remember the following general tips:

Step 3: Implement a Makefile
(20% of total points, 60% complete when done)

If you are new to Makefiles, or rusty, consult the Appendix on Makefiles in your Andersen textbook for a tutorial, or come see me for help. We'll also review a bit during lecture.

A few things to remember:

To test your Makefile, just type "make" at the command line. Also try "make clean" followed by "make". It should compile your code.

Step 4: Write a main program to test your class
(20% of total points, 80% complete when done)

Some specific requirements for your main program:

A warning to those to want to go above and beyond, and show off all their skills: keep it simple!

Step 5: Make a tar file.
(10% of total points, 90% complete when done)

Don't start this step until you have finished all your programming, and are ready to submit your work.

However, if you are new to the process of creating a tar file, don't wait until the last minute—you may need some time to figure this part out.

Background

A "tar" file is a file that allows an entire collection of files to wrapped up into a single file.

You may be familiar with "zip" files, which are often used to distribute software packages on Windows PCs, or "sit" files which are used to distribute files on Macintosh computers. The files known as "tar" files are similar.

(A bit of history: "tar" originally stood for "tape archive". It's still the format sometimes used to store backup files on tape drives.)

To create a tar file from your proj1 files, follow these steps:

  1. Change into your ~/cisc220/proj1 directory and do a "make clean". This is very important! If you don't do this step first, you'll end up with a tar file that will be huge; this will annoy your TAs greatly and cause your final grade to be lowered.
  2. Change directory to one directory above your ~/cisc220/proj1 directory, i.e. to ~/cisc220 You can you can use "cd .." to move up one level from your current directory, or you can use "cd ~/cisc220" to go there directly.
  3. Use the command:
      tar -cvf proj1.tar proj1
    This command says "create a new tar file named proj1.tar"
    (that's the -cvf proj1.tar part) and put all the files from the subdirectory proj1 into it.
  4. To test your file, create a new subdirectory called ~/cisc220/test, and cd into it.
    Copy your proj1.tar file into that directory. Then use the command:
      tar -xvf proj1.tar
    This command should expand the proj1.tar file, and leave you with a new subdirectory ~/cisc220/test/proj1 that contains all of the files from your real proj1 directory. Change your working directory into that test directory and use the "ls" command to list your files. Make sure everything looks correct, because this is what your TA and instructor will see after you submit. So, try the "make clean" and "make all" rules to make sure everything still works properly. If so, then you can now submit "proj1.tar" along with a script (proj1.txt) as your submission to WebCT.

    Note: if this is your first time creating a tar file, you have reached a milestone in your development as a Unix programmer: you have created your first "package". A package is a tar file that contains source code, and a Makefile. Sometimes these packages are called "tarballs", and they are how professional Unix programmers distribute their software.

Step 6: Final Submission:
(10% of total points, 100% complete when done)

Correctly script your program and submit all of the above via WebCT and via paper printout (unless your TA tells you he/she doesn't want a paper copy).

If you are unfamiliar with using the "script" program on strauss (e.g. because you took CISC181 somewhere other than UD, or because its been a while), ask your instructor to walk you through it.

Your final submission should include your .h files and .cc files for your Person_C class, a Makefile, and your main program proj1.cc. It's ok if you also include dummyMain.cc, but that isn't required.

Make a script showing a clean compile (make clean; make all) and demonstration run(s) of your program on all three data files (fiveNames.txt, tenNames.txt and elevenNames.txt) along with cat and ls commands where needed to show input and output files.

You always are required to submit the script file to WebCT separately even if it is included in your tar file.

You should also submit a tar file containing your code, Makefile, and input files. (do a Make clean first; points deducted if you don't). Your tar file can contain your script file, but it doesn't have to.

Submissions must be uploaded and submitted on WebCT to count!

Some strict results regarding submissions:

End of Project 1, CISC220, 06J