2005 ICS3M FINAL EXAM-JavaFriday, June 3th. 1:00 p.m.INSTRUCTIONS TO STUDENTS.
|
||||||||
Question 1. ALGORITHMIC. (Degree of Difficulty:0.7) | ||||||||
Perimeter of a 2D PolygonYou are familiar with the formula for the distance, d, between two points (x1,y1) and (x2,y2) in mathematics, If we knew the coordinates of the vertices of a polygon in a cyclic order, we could use this formula to accumulate the lengths of the sides of the polygon and, hence, determine its perimeter. Task. In this question, you are asked to write the Polygon2D class that can be used with this driver to yield the following output. |
||||||||
Question 2. CLASS DESIGN. (Degree of Difficulty:1.0) | ||||||||
Logic GatesSuppose we are working on a 'circuit editor' for an interactive PC-board design application. The class LogicElement is an abstract class that represents a logic element in a circuit. The classes Signal and Gate are derived from LogicElement. A Signal represents a true or false input signal. A Gate represents an AND, OR, or NOT gate. From your 'other' course, you know that the NAND gate is sometimes referred to as the Universal gate since a circuit using one or more NAND gates can be constructed to simulate the output of the other gates. (see graphic). Tasks.
|
||||||||
Questions 3. GRAPHIC. (Degree of Difficulty:1.05) | ||||||||
Julia SetsYou will recall that the Mandelbrot Set consists of the set of points, c, in the Argand (Complex) Plane, whose orbits under the iterative formula, z <- z2+c never reach a magnitude greater than 2.0, where z starts at 0+0i. The algorithm for Julia Sets is very similar in that the orbits are also considered under the iterative formula, z <- z2+c, however c remains fixed over the entire map while -2.0 <= Re(z) <= 2.0 and -2.0 <= Im(z) <= 2.0. Two other important considerations are the number of ITERATIONS is carefully chosen and the magnitude is expanded to 10. Consider the examples below. The Black pixels are points that are not in the Set, the coloured pixels represent points that are in the Set in which the magnitude obtained is used to select a colour from the palette. Task. Adapt the Platform Application used to generate Mandelbrot Sets to produce the following four Julia Sets. Feel free to use any palette you wish (even a random one as below).
|