Docsity

Study Guide for Exam - Representing Structure and Behavior | CS 1316, Study notes of Computer Science

Toggle sidebar
bg1
Recitation Guide Wednesday May 23, 2007
A. Handle Installation Issues
a. If necessary, quickly run through how to set up Dr. Java.
b. Try to handle individual issues as quickly as possible. If necessary, employ the help of
students to help out with a general walkthrough.
B. Quiz 1
a. Feedback.
b. Comments on length, difficulty level, preparedness going in.
C. Homework 2 and introduction to Turtles
a. Homework 2 is due on Friday. TSquare is still in the process or being set up. Email will be
our backup method.
b. Go through Homework 2’s assignment description answer any questions. Teach
students how to use
FileChooser.setMediaPath("C:/cs1316/MediaSources/“); and
FileChooser.getMediaPath("swan.jpg");
i. Remember that the MediaPath needs to be set ONLY ONCE on a computer.
Please tell students how the inclusion of FileChooser.setMediaPath()
in homework is incredibly annoying for grading homeworks.
c. World and Picture canvas
i. Remember that Turtles need to be given either a World or a Picture (blank or
not) to play in!
ii. //Turtles default to invisible
World w = new World;
iii. //Turtle default to visible
Picture canvas = new Picture (500,500);
iv. //Turtles default to invisible
Picture swan = new
Picture(FileChooser.getMediaPath("swan.jpg"));
d. Turtles
i. World w = new World();
Turtle t = new Turtle(w);
t.setVisible(true); //set t to be visible
ii. See TurtleSquares.java for a good example of how to use Turtles to
draw boxes.
iii. Other useful methods in SimpleTurtle.java
1. penUp();
2. penDown();
3. getHeading();
4. setHeading();
5. forward(); //defaults to 100 pixels
6. forward(int pixels);
7. getXPos();
pf2

Partial preview of the text

Download Study Guide for Exam - Representing Structure and Behavior | CS 1316 and more Study notes Computer Science in PDF only on Docsity!

Recitation Guide Wednesday May 23, 2007

A. Handle Installation Issues a. If necessary, quickly run through how to set up Dr. Java. b. Try to handle individual issues as quickly as possible. If necessary, employ the help of students to help out with a general walkthrough. B. Quiz 1 a. Feedback. b. Comments on length, difficulty level, preparedness going in. C. Homework 2 and introduction to Turtles a. Homework 2 is due on Friday. TSquare is still in the process or being set up. Email will be our backup method. b. Go through Homework 2’s assignment description answer any questions. Teach students how to use FileChooser.setMediaPath("C:/cs1316/MediaSources/“); and FileChooser.getMediaPath("swan.jpg"); i. Remember that the MediaPath needs to be set ONLY ONCE on a computer. Please tell students how the inclusion of FileChooser.setMediaPath() in homework is incredibly annoying for grading homeworks. c. World and Picture canvas i. Remember that Turtles need to be given either a World or a Picture (blank or not) to play in! ii. //Turtles default to invisible World w = new World; iii. //Turtle default to visible Picture canvas = new Picture (500,500); iv. //Turtles default to invisible Picture swan = new Picture(FileChooser.getMediaPath("swan.jpg")); d. Turtles i. World w = new World(); Turtle t = new Turtle(w); t.setVisible(true); //set t to be visible ii. See TurtleSquares.java for a good example of how to use Turtles to draw boxes. iii. Other useful methods in SimpleTurtle.java

  1. penUp();
  2. penDown();
  3. getHeading();
  4. setHeading();
  5. forward(); //defaults to 100 pixels
  6. forward(int pixels);
  7. getXPos();
  1. getYPos();
  2. moveTo(int x, int y);
  3. turn(int degrees);
  4. turnLeft();
  5. turnRight(); iv. Dropping Pictures with Turtles and MyTurtlePicture.java
  6. MyTurtlePicture.java has a good example of a Turtle dropping Pictures.
  7. drop(Picture p) //method to drop Pictures
  8. Remember the Turtle always drops the picture on his right foot
  9. turnRight(); v. Sample solution (well sort of) using just Turtles and flip()
  10. PictureCollage.java
  11. This is just kind of to show that there is a way to just get all the Turtles to do the work for you. The mirroring doesn’t have to be exact “mirroring.”Llike if you removed all of the flip()s from my code it’s still okay. The whole point is to get them to use Turtles to move and drop the Pictures. The whole prettiness factor is something for the extra credit. Also notice that I didn’t do any picture manipulations that are necessary for this assignment. I guess we can allow them to use flip() since it really isn’t a mirroring method.