Fall 2004 |
Clay Shields |
Project 3 - Guide Puppy Growth Prediction
Assigned: October 27, 2004 |
Guide Puppy Growth PredictionNow that the guide dog organization has some master programmers available, they want to try some more sophisticated techniques in raising their puppies. Specifically, they suspect there is a relationship between how fast the puppies grew and eventual health problems as adult guides. All puppies are currently fed as a litter and they think that the larger pups are eating more and growing faster at the expense of the smaller pups. They think that the pups who eat more tend to be overweight as adults and they the smaller pups who eat less are more prone to infection. They do have do have historical data from weighing the puppies periodically after they have been weaned to solid food going back to about 1992. They also know from veterinary experiments how much the dogs should weigh at different ages by sex, as shown below:
What they would like you to do is write a program that will read files that have the data about individual puppies, and to write out a file that contains the same data, but with a record added at the end about whether the pup was more that 20% over the normal weight or under it for each date it was weighed. The input files have the format:
<Puppy name> The output file should have the format:
<Puppy name> where <status> is one of: Average, Overweight, Underweight, depending on if the pup is within 20% of average, or above or below that. There is a small problem with the files, though. The volunteers who weighed the puppies don't come in regularly, so some of the weighings are off from when they should have been. Because the pups do grow so fast, you cannot just use the closest weekly weight. Instead, you will need to find out how many days old the pup was when it was weighed and then use linear interpolation between the weights by week and compare against that calculated value. Here is a sample of what a data file might look like:
Benny Here are two sample data files and their output: And this is what my version of the program looks like when it runs, though it isn't too helpful:
gusun> growpup
Please enter the input file name: kaiser Hints and requirementsSince one goal of this project is to learn to use functions, you must include one call-by-value function and one call-by-reference function in your submission (if you don't know what those are yet, don't worry - we will get to them first thing next class). The hard part of this project is reading the dates and computing how many days passed between them. To give you an idea how to do this, I outline the functions I use in my solution and hot to implement and test them. It is only a suggestion, and you may choose to do it differently. I certainly recommend you do not write the program all at once. Instead, write pieces and test each separately. This program seems big, but is really built from many small pieces, none of which is complicated on its own.
What to submit
Part 1 - Design DocumentFor the first part you are to submit a design document showing the algorithm you plan to implement. Do not submit a flowchart for this assignment. You should write it out neatly using a language which is similar to that from Homework 1 and has the following terms:
statement ... statement end A copy of your algorithm is due in class. Be sure to keep a copy for yourself!
Part 2 - Program Source CodeInclude the following header in your source code.
//
You will submit your To submit your program, make sure there is a copy of the source code on your account on gusun. You may name your program what you like - let's assume that it is called growpups.cc. To submit your program electronically, use the submit program like we did in Homework 2 and project 1, but with the command: submit -a p3 -f growpups.cc I will not be enabling the electronic submission until after the design documents are in, so don't try to submit too early. |