37-practice-final-problem

37-practice-final-problem - CS 106A Handout #36 Aug 11,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #36 CS 106A Aug 11, 2009 Extra Practice Final Problems This handout is intended to give you practice solving problems that are comparable in format and difficulty to those which will appear on the final examination. A solution set to these practice problems will be published online on Wednesday the 12th. Please try to take these in test conditions! Problem —Graphics and interactivity (15 points) Write a GraphicsProgram that does the following: 1. Add buttons to the south region labeled "North" , "South" , "East" , and "West" . 2. Create an X -shaped cross ten pixels wide and ten pixels high. 3. Adds the cross so that its center is at the center of the graphics canvas. Once you have completed these steps, the display should look like this: North South East West EtchASketch 4. Implement the actions for the button so that clicking on any of these buttons moves the cross 20 pixels in the specified direction. At the same time, your code should add a red GLine that connects the old and new locations of the pen. Keep in mind that each button click adds a new GLine that starts where the previous one left off. The result is therefore a line that charts the path of the cross as it moves in response to the buttons. For example, if you clicked East , North , West , North , and East in that order, the screen would show a Stanford “S” like this:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
– 2 – North South East West EtchASketch Problem —Strings (15 points) There is no gene for the human spirit. —Tagline for the 1997 film Gattaca The genetic code for all living organisms is carried in its DNA—a molecule with the remarkable capacity to replicate its own structure The DNA molecule itself consists of a long strand of chemical bases wound together with a similar strand in a double helix. DNA’s ability to replicate comes from the fact that its four constituent bases—adenosine,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

37-practice-final-problem - CS 106A Handout #36 Aug 11,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online