Project 1
Spring 2005
Due: Feb 11 @ 5 PM
6 points
Joe's Dawg Shack is a vet clinic specializing in dogs. Not only does Joe care for domestic dogs, but she also cares for guide dogs, which have special health, nutrition, and training needs.
Joe contacted you to develop a program that keeps track of the animals currently in her kennel. Most important is the software computes and prints the total weight of the dogs in the kennel, which Joe uses to determine how much food to purchase.
Design and implement the Animal class. Animals have a name and a gender.
For storing information about dogs, use inheritance to derive the Dog class from the Animal class. Dogs have a weight and a county-assigned identification number.
Similarly, for storing information about guide dogs, derive the GuideDog class from the Dog class. Guide dogs have an identification number assigned by Guide Dog Organization, Inc.
For each of these classes implement the necessary virtual and non-virtual methods. For example, Animal::getGender should be a non-virtual method, whereas the print() method should be virtual.
Design and implement the Dogs class, which uses a C++ vector to store information about animals (i.e., dogs and guide dogs). Implement methods to read dogs from a file, print the dogs in the vector, and compute the total weight of those dogs.
Design a file format for a class, which stores information about dogs in a hypothetical kennel. Fabricate data for three dogs and three guide dogs.
In the main function, write a simple driver program that reads dogs from your data file and stores them in a Dogs object. It should then print the dogs to the console. It should also print the total weight of the dogs.
Use stepwise refinement and incremental development. For example, implement the Animal class and test it thoroughly before implementing the Dog class.
You must provide a working UNIX Makefile with your submission. Start with this Makefile, which compiles a project consisting of main and animal.
All class definitions and class methods must be documented with Doc comments. Doc comments for class definitions must include @author and @version tags. Doc comments for methods must include @param and @return tags, where appropriate.
Place all of your code in a subdirectory named p1. To create this subdirectory, type
gusun% mkdir p1To descend into the directory, type
gusun% cd p1All of the files for your project should be in this directory.
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.
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 modifications:
// // COSC 072 Project 1 // Name: <your name> // ID: <GoCard ID> // E-mail: <e-mail address> // Instructor: Maloof // TA: <TA's name> // // 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. //
Although you may use any C++ compiler to develop your program, it must run under UNIX and must compile using GNU g++. You must also provide a working UNIX Makefile for your project.
Before submitting, to reduce the size of the tar file, type 'make clean'.
To move up from the p1 directory, type
gusun% cd ..(Additional UNIX commands at the bottom of this page: HOWTO Compile under UNIX)
When you're 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
gusun% mv p1 maloofmCreate a tar (tape archive) file of the directory and its contents by typing
gusun% tar -cf p1.tar maloofmThis command creates a tar file named p1.tar containing the directory maloofm/ and the files therein.
Compress the tar file by typing:
% gzip p1.tarThis command will produce a file named p1.tar.gz, which is the gzipped tar file of the directory containing your project. Whew!
To submit the file, type
gusun% submit -a p1 -f p1.tar.gzp1 is the name of the assignment (-a) and p1.tar.gz 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., gusun or cssun). System administrators routinely back up these machines.
You can also change the directory's name back to the original name. For example,
gusun% mv maloofm p1You can also remove the tar file from your directory:
gusun% rm p1.tar.gz
The TAs who will be grading your projects this semester are listed on the main page. You must submit your project before 5 PM on the due date.
If you're running submit correctly and you see an error message labeled as SEVERE, then execute Plan B by using pine to submit your project as an attachment to an e-mail.
To accomplish this, at the gusun prompt, type 'pine'. When the menu appears, select the menu item for composing messages (C). In the To field, type the e-mail address cosc072maloof@cs. Attach your zip file. Control-T (symbolized ^T) will give you a list of files. Select the file to attach. The subject should be your netid followed by the extension .zip. For example, if your netid is maloofm, then the subject of the e-mail should be maloofm.zip. There's no need to include anything in the MESSAGE TEXT screen.
Once you've entered this information, the screen should look something like the following:
Finally, type ^X (Ctrl-X) to send the e-mail to the course account.