Download presentation
Presentation is loading. Please wait.
Published byNeil Allen Modified over 9 years ago
1
Clicker quiz 9/17/13 CSE 1102 Fall 2013
2
// In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob public void mousePressed(MouseEvent e){ super.mousePressed(e); _leftEye.setSize(30,5); _leftEye.setLocation(_leftEye.getLocation().x, _leftEye.getLocation().y-15); } // in TalkativeBlob public void mousePressed(MouseEvent e){ _bubble.show(); } Why is there a # before _leftEye and _rightEye in the class diagram A.There are multiple eyes B.Each eye is identified by a number C.Each eye is a private instance variable D.Each eye is a protected instance variable E.None of the above
3
// In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob public void mousePressed(MouseEvent e){ super.mousePressed(e); _leftEye.setSize(30,5); _leftEye.setLocation(_leftEye.getLocation().x, _leftEye.getLocation().y-15); } // in TalkativeBlob public void mousePressed(MouseEvent e){ _bubble.show(); } Given this code, when you press the mouse on a Blob, it A.Turns its eyes blue B.Turns blue C.Turns the eye you press on to blue D.All of the above E.None of the above
4
1.public class FirstApp extends wheels.users.Frame { 2. private wheels.users.Ellipse _ellipse; 3. public FirstApp() { 4. _ellipse = new wheels.users.Ellipse(); 5. } 6. public wheels.users.Ellipse getBall(){ 7. return _ellipse; 8. } 9. public static void main(String[] args) { 10. FirstApp app = new FirstApp(); 11. wheels.users.Ellipse fred = app.getBall(); 12. fred.setLocation(0,0); 13. } 14.} What happens on the screen when I execute line 12? A. Nothing B. A second ellipse shows up in the upper left corner C. The ellipse is now in the upper left corner D. We never call it because the code does not compile E. None of the above
5
Clicker questions 9/17/13 CSE 1102 Fall 2013
6
1.public class FirstApp extends Frame { 2. private Ellipse _ellipse1, _ellipse2; 3. public FirstApp() { 4. _ellipse1 = new Ellipse(Color.RED); 5. _ellipse2 = new Ellipse(Color.GREEN); 6. _ellipse2.setLocation(200,200); 7. } 8. public Ellipse getSecondBall(){ 9. return _ellipse2; 10. } 11. public void propagateColors(Color aColor){ 12. _ellipse2.setColor(_ellipse1.getColor()); 13. _ellipse1.setColor(aColor); 14. } 15. public static void main(String[] args) { 16. FirstApp app = new FirstApp(); 17. app.propagateColors(Color.CYAN); 18.} What happens when I call propagateColors in line 17? A. Each ellipse takes the original color of the other B. Nothing happens C. Both ellipses are colored CYAN D. The two ellipses are colored CYAN and RED E. The two ellipses are colored CYAN and GREEN
7
1.public class FirstApp extends wheels.users.Frame { 2. private wheels.users.Ellipse _ellipse1, _ellipse2; 3. public FirstApp() { 4. _ellipse1 = new wheels.users.Ellipse(Color.RED); 5. _ellipse2 = new wheels.users.Ellipse(Color.GREEN); 6. _ellipse2.setLocation(200,200); 7. } 8. public Ellipse getSecondBall(){ 9. return _ellipse2; 10. } 11. public void propagateColors(Color aColor){ 12. _ellipse2.setColor(_ellipse1.getColor()); 13. _ellipse1.setColor(aColor); 14. } 15. public static void main(String[] args) { 16. FirstApp app = new FirstApp(); 17. app.propagateColors(app.getSecondBall().getColor()); 18.} What happens when I call propagateColors in line 17? A. Each ellipse takes the original color of the other B. Nothing happens C. Both ellipses are colored RED D. Both ellipses are colored GREEN
8
// In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob public void mousePressed(MouseEvent e){ super.mousePressed(e); _leftEye.setSize(30,5); _leftEye.setLocation(_leftEye.getLocation().x, _leftEye.getLocation().y-15); } // in TalkativeBlob public void mousePressed(MouseEvent e){ _bubble.show(); } Given this code, when you press the mouse on a WinkingBlob, it A.Turns blue B.Changes the size and shape of its left eye C.It does A, then B D.It does B, then A E.It does neither A nor B
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.