CPSC 120B Fall 2003
Program 1: Arts and Crafts
Due Friday, September 19

Problem

As regional coordinator for the Tiny Tots Daycare Centers, it is your responsibility to plan activities for the children and purchase supplies. You have found that one of their favorite activities is making faces out of felt; you provide colorful cutouts of heads, eyes, mouths, and other parts and they put them together. You always have a hard time figuring out how much felt to buy, and since your budget is tight, you don't want to waste any. Felt is sold is 12"x18" sheets, and there is a small discount if you buy it in packs at 20 sheets/pack. You have found that there is about 20% waste due to inexact fit, cutting error, and so on, so only 80% of the felt that you purchase actually goes into the faces.

You have decided to write a program to figure out how much felt is needed for a given size face and a given number of children. This year you are doing simple faces with a circle for a head, equilateral triangles for eyes, and a semicircle for a mouth. For the proportions to look right, you have determined that the length of one side of each eye should be 1/8 the diameter of the head, and the diameter of the mouth should be 1/2 the diameter of the head.

Input and Output

Your program should prompt the user for the following input: Provide the following information as output: All of this should be nicely formatted and labeled. For example, for a face 8" in diameter and 200 children, your output might look like this:
You want to make 200 faces, each 8" in diameter.
Felt needed for a single face: 57.41 sq in.
Felt needed for 200 faces: 79.74 sq ft.
Total felt needed, including waste: 99.68 sq ft.
Packs of felt needed: 3
Additional sheets needed: 7

Program Requirements

Think carefully about the appropriate type for each variable; if a variable will always hold a whole number, it should be an int. However, be sure that your calculations are as precise as possible, using floating point (double) values and variables as appropriate. Minimize the use of literal values in your program; in most cases you should use named constants instead. Avoid excessively complex calculations. Instead, break up your calculations and store intermediate values so that it is clear to the reader what you are doing. Note that it is often helpful to print intermediate values while you are debugging.

Documentation

Provide a program header that gives your name, the name of the file, and a description of the program. Use good names for variables and constants, and use an explanatory comment whenever a variable's function is not clear from its name. Follow the capitalization conventions discussed in class. Your code should fall into logical sections (e.g., input/several groups of calculations/output), with each section introduced by an explanatory comment.

What to Turn In

Turn in hardcopy of your program and e-mail the source code to bloss@roanoke.edu. Put cpsc120 prog1 in the subject line. Both the hardcopy and the e-mail are due by 4:00 on the date above.