Fall 2004 |
Clay Shields |
Project 1 - Puppy food calculator
Assigned: Sept. 22 |
Puppy Food PurchasingIn order to provide disabled people with service animals, guide dog organizations breed and raise hundreds of puppies a year. For this project, you are going to program a calculator that a guide dog organization can use to order food to feed their puppies. Here is a gratuitous picture of some guide dog puppies to keep you motivated. Don't make them go hungry!
Puppies get introduced to solid food gradually starting at five weeks of age, and go to homes to be raised when they are nine weeks old. They get three meals a day and are fed a mixture of dry food and canned food. The mixture for each meal varies by age as show in the table below.
Dry dog food comes in large bags weighing 10 pounds. Each bag costs $5.40. Cans of puppy food contain 12 ounces, and cost $1.25. Sales tax on dog food is 4%. Sometimes stores will give a discount to the guide dog organization, though the percentage they give varies. What you need to do is write a program that takes as input the number of puppies of each age, and if there is a discount and if so how large it is. It then outputs a shopping list of how many cans and bags of puppy food to purchase, as well as the total cost of the food without discount, the cost with the discount applied if applicable, the amount of the tax on it (tax is computed on the discounted total if applicable), and the total cost with tax for the accountants. A sample run of a program that does this is: Welcome to the puppy food purchasing program What to submit
Part 1 - Design DocumentFor the first part you are to submit a design document showing the algorithm you plan to implement. You may submit the algorithm as a flowchart, or may write it out neatly using a language which is similar to that from Homework 1 and has the following terms:
statement ... statement end
Part 2 - Program Source CodeImportant: Your output and input should be very similar to that shown in the example program. Please ask for the input in exactly the same order shown (you will not ask for the discount rate if no discount is given), and only request the same items shown - do not ask for any other input. This will assist in grading your program.Include the following header in your source code. // // Project 1 // Name: <your name> // E-mail: <your e-mail address> // COSC 071 // // In accordance with the class policies and Georgetown's Honor Code, // I certify that I have neither given nor received any assistance // on this project with the exceptions of the lecture notes and those // items noted below. // // Description: <Describe your program> //
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 puppies.cc. To submit your program electronically, use the submit program like we did in Homework 2, but with the command: submit -a p1 -f puppies.cc I will not be enabling the electronic submission until after the design documents are in, so don't try to submit too early. UpdateI realized I didn't make clear what happens when there is no discount. Here is an example run of my solution without a discount. Notice that the discounted total is not shown if there is no discount!Welcome to the puppy food purchasing program |