1 EtchASketch Report Your Names [10 points!] EtchASketch, Part 0 Question: 1. What was the value of d after the first of the above two statements was executed? 2. After the second statement was executed? 3. What would be the value of the expression d + 1 after the above two statements were executed? 4. Would the statement return (d + 1); change the value of d? Question: Suppose that the rule for both knobs is "increase the current position by 1." Suppose further that the two instruction-followers alternate turns (first the horizontal instruction-follower, then the vertical, then the horizontal again, then vertical again, and so forth). What would the resulting picture look like? Question: Again suppose that the rule for both knobs is "increase the current position by 1." But this time suppose that the horizontal instruction-follower checks its rule twice after each time the vertical instruction-follower checks its rule (first the horizontal instruction-follower, then horizontal again, then vertical, then horizontal again, then horizontal again, then vertical, and so forth). What would the resulting picture look like? Question: What four points represent the four corners of the EtchASketch window? Question: What rule would keep the dot centered horizontally (halfway between the left and right edges) on the screen? Is this a horizontal- or a vertical-knob control rule? Question: How would you position the dot almost in the upper right-hand corner? The answer should involve a horizontal rule and a vertical rule. Question: How about the upper left-hand corner? Again, the answer should involve a horizontal rule and a vertical rule. Question: Assume that you have rules that position the dot in the upper left-hand corner. Now suppose that you swap the horizontal and vertical rules. Where is the dot now? What if you use the horizontal rule for both horizontal and vertical behavior? EtchASketch, Part 1 Question: How long do you think it will take you to complete Part 1? Question: What time is it now? 2 Question: The HorizontalKnob.java contains a single class and a single method in that class. 1. What is the name of the class? 2. What is the name of the method? Question: Combining these two observations -- leaving trails and "jumping" the dot around using the mouse -- how can you create an asterisk (a bunch of line segments intersecting in the center)? Question: How much time did you spend on Part 1 of EtchASketch? (Add 5 minutes for the remaining steps.) EtchASketch, Part 2 Question: How long do you think it will take you to complete Part 2? Question: What time is it now? Question: Using this information, write a rule that causes the dot to stay where each mouse-click puts it. Question: Why is this principle a good idea? That is, why should we allow two names to refer to different things in different parts of a program? (Hint: think big.) Question: What is the scope of position in the knobRule method for the vertical knob? Question: Is maxPosition a parameter of the knobRule methods? Question: What would such a rule look like, that causes the dot to move and keep moving.? Question: Consider the two versions of the knobRule method above. In what way is the first version clearer than the second? In what way is the second version clearer than the first? Overall, which seems clearer to you, the first version or the second? Question: Consider the following method (which has nothing to do with EtchASketch). How many parameters are in the above method? What are their names? What are their types? How many local variables are in the above method? What are their names? What are their types? Question: What happens when the dot reaches the edge? Question: How could you make the dot start and move left? Try it out in EtchASketch. 3 Question: What would happen if you used the rules ... Question: How would this be different if the rules were ... Question: What does the dot do if you start in the lower left hand corner of the screen (by using the mouse) and use the rules... Question: How can you make the dot move more quickly across the window? Question: How much time did you spend on Part 2? EtchASketch, Part 3 Question: How long do you think it will take you to complete Part 3? Question: What time is it now? Question: How can you make the dot move from the maxPosition edge of the screen to the other edge when it gets there? That is, how can you make the dot "wrap around?" Question: Write your rules that give the barber-shop pole effect in your report. Question: Think through what the dot will do if you use the above rule. Then try it in EtchASketch and see what actually happens. If the actual result is different from the result you expected, figure out what is going on. (Get help as needed.) In your report, indicate both your expected result and the actual result. Question: Write the statement that defines increasing to be a boolean whose initial value is true. Question: Include in your report your (correct) rule for having the dot bounce back from the edge -- turning to move in the opposite direction. Question: Include in your report your (correct) rule for having the dot bounce back from the edge using previousPosition. Question: So in the above code, previousPosition is a field and velocity and newPosition are local variables. What is position? What is otherPosition? Question: Include in your report your (correct) rules that implement constant acceleration. Question: Summarize in 10 sentences or less the most important lessons that you learned from EtchASketch. Question: How much time did you spend on Part 3 of EtchASketch? (Add 5 minutes for the remaining steps.) EtchASketch, Part 4 Question: For any of the following challenges that you try, write in your report: 4 The rules that you used. The results that you obtained on the drawing window. The ideas that the challenge exposed and what you learned from the challenge.
© Copyright 2026 Paperzz