PROG6. -- ENVIRONMENTALLY FRIENDLY CAD PROGRAM

logo6q.jpg (14644 bytes)The wall at the bottom of my garden is falling apart. I am going to have to rebuild it at ENORMUNGUS ENORMUS ENORNEOUS very large cost. Your job is to write a CAD (Computer Aided Drawing) program to help me count the cost. The wall is always 6 units long and may be up to 6 units high -- you will see exactly what this means in a minute.

The first thing the CAD program must request is the size of the left and right parts of the walls. Suppose the judges enter the number 44 (forty-four). This means the height of the left part of the wall is 4 units high and the height of the right part of the wall (second number) is 4 units high. Later on the judges may enter in walls with edges of different sizes -- but not at the beginning.

Draw a picture of the wall with the correct proportions -- See example at the side

- WIDTH 6 units LEFT 4 units RIGHT 4 UNITS

Next draw over the top of the picture of the well a series of little blocks 1 unit wide and 1 unit high. This shows the number of blocks needed to build the wall. Count the blocks as you draw them -- there should be 24. Report that number to the judges.

I have given you an example at the side with the small blocks drawn with a THIN line. If you can get your program to do this great -- but there are no marks for this feature.

Now you've had a little practice, you can start tackling REAL walls which don't have even sides -- Suppose the judges now enter in the numbers 26. This means the left wall is 2 units high and the right wall is 6 units high. (See the hint at the bottom about angles for use when drawing.)

Draw a wall with the right proportions -- See example at the side

You could calculate how many bricks to use by drawing all the bricks as shown in the picture at the side. This would mean that you would tell the judges that 36 bricks were needed. If you bought this number of bricks you could

That is not an environmentally friendly CAD program.

Instead, you should only draw (and count) the bricks that can be used to build the wall. Any bricks that are totally outside the shape of the wall should not be drawn. (See the picture at the side.) In this case -- your environmentally friendly CAD program would report (and show) the use of only 28 bricks

The judges have provided you with another example -- when they input 24 for the wall sizes

HINTS ON DRAWING ANGLES -- The Judges are more interested in whether you can work out how many bricks to use than whether the angle on the top of the wall is exactly right.

Here is some information about angles to use when the walls are of a different height.

Use 45 degrees if the walls differ by 6 units
Use 40 degrees if the walls differ by 5 units
Use 34 degrees if the walls differ by 4 units
Use 27 degrees if the walls differ by 3 units
Use 18 degrees if the walls differ by 2 units
Use 10 degrees if the walls differ by 1 unit


Copyright -- Calgary Programming Society -- Last Modified:- 1999, May 16, 06:04 PM by M. Smith