Clicker quiz 9/17/13 CSE 1102 Fall 2013. // In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob.

Slides:



Advertisements
Similar presentations
So what's next? Introduction to data structures Two Perspectives: Abstract description (capabilities) Implementation(s) For structures: Stack Queue Deque.
Advertisements

First BlueJ Day Houston, 2006 David J. Barnes University of Kent.
 It is possible to declare names for object references and not assign object references to them.  Such names literally refer to nothing at all.  It.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
2D Graphics in Java COMP53 Nov 14, Applets and Applications Java applications are stand-alone programs – start execution with main() – runs in JVM.
Created by Ron Beglieter (based on the Java Tutorial) 1 What is Java? Java technology is both a programming language and a platform; Programming Language.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
Using FangEngine The FangEngine is created by Brian C. Ladd & Jam Jenkins Presentation by Pepper With much credit to: Jenkins, Jam & Brian C. Ladd. Introductory.
Agenda For Feb Finish up Unit 3 Exercises on page Unit 4 Exercises on page 33. Question #2 3. Create a Happy Face Java Applet (due next class).
Java: Chapter 1 Computer Systems Computer Programming II.
CSE 219 Computer Science III Images. HW1 Has been posted on Blackboard Making a Game of Life with limited options.
Inheritance CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
A way to pull together related data A Shape Class would contain the following data: x, y, height, width Then associate methods with that data A Shape.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Static Methods. 2 Objectives Look at how to build static (class) methods Study use of methods calling, parameters, returning values Contrast reference.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Clicker questions 10/24/13 CSE 1102 Fall θ (x,y) (0,0) What is the relationship between θ and (x,y) ? A.y = mx + b B.θ = x 2 + y 2 C.tan(θ) = x/y;
Session 22 Chapter 11: Implications of Inheritance.
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
The assignment expressions. The assignment operator in an assignment statement We have seen the assignment statement: Effect: var = expr; Stores the value.
Clicker quick questions 10/17/13 CSE 1102 Fall 2013.
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
Java Basic Syntax. Object - Objects have states and behaviors. –Example: A dog has states-color, name, breed as well as behaviors -wagging, barking, eating.
Bridge Bridge is used when we need to decouple an abstraction from its implementation so that the two can vary independently. This type of design pattern.
Clicker quiz 10/8/13 CSE 1102 Fall 2013 (E-30 reminder!)
Gayle J Yaverbaum School of Business Administration Penn State Harrisburg Fall 2006 Object-Oriented Design and Program Development in Business INFSY
Methods.
Enum,Structure and Nullable Types Ashima Wadhwa. Enumerations, Enumerations, or enums, are used to group named constants similar to how they are used.
Swing GUI Components So far, we have written GUI applications which can ‘ draw ’. These applications are simple, yet typical of all Java GUI applications.
CSE8A Lecture 5 TODO: –FINISH PSA2 WITH YOUR PARTNER! Read next class: Section 5.1. PLAY WITH CODE! –Get stuck, then figure out how to get unstuck – it’s.
Clicker quiz 9/3/13 CSE 1102 Fall Look out behind you! The picture associated with one of the instructors on Piazza includes an animal. That animal.
COP 2220 Computer Science I Topics –Breaking Problems Down –Functions –User-defined Functions –Calling Functions –Variable Scope Lecture 4.
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values.
Clicker quiz 11/5/13 CSE 1102 Fall A. a FlowLayout B. a BorderLayout C. a GridGrouping D. a JSplitPane E. a GridLayout Suppose we want to to lay.
Clicker questions 10/3/13 CSE 1102 Fall public class { … private _ ; public ) { … _ = ; … } … } In the above code, what is the purpose of the parameter.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Recitations Sep 8-9 u conditionals: if-else statement u boolean expressions u classes and instances.
Clicker quiz 10/29/13 CSE 1102 Fall __________ is visible to code in the inner class (at ????, say): A.All protected methods and protected instance.
Clicker quiz 10/1/13 CSE 1102 Fall public class Sun extends Ellipse { 2. public Sun(Color c) { 3. super(c); 4. … 5. } 6. public Sun() { 7. this(Color.yellow);
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Gayle J Yaverbaum School of Business Administration Penn State Harrisburg Fall 2006 Object-Oriented Design and Program Development in Business INFSY
Clicker quiz 10/22/13 CSE 1102 Fall 2013.
Java Applets.
Clicker questions 10/3/13 CSE 1102 Fall 2013.
COMPUTER 2430 Object Oriented Programming and Data Structures I
Building Java Programs
Clicker quiz 10/1/13 CSE 1102 Fall 2013.
Chapter 5 Hierarchies IS-A associations superclasses subclasses
Basic Graphics Drawing Shapes 1.
CS 302 Week 11 Jim Williams, PhD.
Writing Methods.
Computing Adjusted Quiz Total Score
CSC 113 Tutorial QUIZ I.
Topic 8 graphics "What makes the situation worse is that the highest level CS course I've ever taken is cs4, and quotes from the graphics group startup.
Clicker quiz 10/15/13 CSE 1102 Fall 2013.
Java Applets.
Example with Static Variable
Here are four triangles. What do all of these triangles have in common
CSE 142 Lecture Notes Graphics with DrawingPanel Chapter 3
class PrintOnetoTen { public static void main(String args[]) {
PreAP Computer Science Quiz Key
Building Java Programs
Sampath Kumar S Assistant Professor, SECE
Topic 9 More Graphics Based on slides bu Marty Stepp and Stuart Reges from
Building Java Programs
Parameters, Overloading Methods, and Random Garbage
Translate 5 squares left and 4 squares up.
Threads CSE451 Andrew Whitaker TODO: print handouts for AspectRatio.
Presentation transcript:

Clicker quiz 9/17/13 CSE 1102 Fall 2013

// 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

// 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

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

Clicker questions 9/17/13 CSE 1102 Fall 2013

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

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

// 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