S A M P L E CPS 1 (Ramm) Fall 2003 8 October 2003 Quiz #5 Name ___________________ Honor Code_______________________ Lab Section _____ A. The following is a fragment of a graphics display program. Roughly sketch the figure below that it should produce. g.setColor(Color.black); g.drawLine(100, 20, 100, 100); g.drawOval(80, 100, 40, 40); [answer: something that's shaped like an upside down lollipop or a round Christmas ball hanging from a string. The + and the horizontal and vertical lines represent the corner and walls of the containing box of the circle. These do not show in the display but are shown here to show you how the circle is located.] 0,0 200,0 +---------+---------+---------+---------+ | | | * | | * | | * | + * + | * | | * | | * | | * | + + - | + | / \| | | | | | | \ /| | | -------- | + + | | | | | | | | +---------+---------+---------+---------+ 0,200 200,200 B. Write the code to draw a red triangle with vertices (10,10), (100, 10), and (55, 70). Assume that everything has been declared and is ready to go. This should take four lines of code. Assume the graphics class you are working with is named g. g.setCololr(Color.red) g.drawLine(10, 10, 100, 10); g.drawLine(100, 10, 55, 70); g.drawLine(55, 70, 10, 10); C. Some true/false or short answer question(s) recursion in graphics D. Some true/false or short answer question(s) regarding animation You should not find the last two hard if you've gone to lecture (and managed to stay awake :-)