You are on page 1of 2

Introduction to Programming with Greenfoot

Chapter 2

Student Name: ________________________ Date: ________ Score: _____


Instructions
Answer the following questions as you work through the exercises in Chapter 2 of the text book. You will be modifying the little-crab scenario, and recording your observations. Be sure to read the text; there will be a quiz over the chapter and a test at the end of the unit.

Exercise 2.1 What did you observe when you clicked run?

Exercises 2.2 and 2.3 What did you observe after making the changes and placing multiple crabs into the world?

Exercises 2.4 and 2.5 How did you make the crab turn left?

Exercise 2.6 Define, in your own words, the what a parameter is:

Exercise 2.7 and 2.8 List at least 5 different error messages, and describe how you caused that error: 1. 2. 3. 4. 5.

This worksheet may be freely modified or distributed for educational purposes. Copyright 2011

Stephen Fornal Juan Seguin High School, Arlington TX

Page 1

Introduction to Programming with Greenfoot

Chapter 2

Exercise 2.9 How many methods does class Animal have? Crab inherits from Animal. What class does Animal inherit from? A Crab is-a Animal. An Animal is-a _____________. Therefore, a Crab is-a ___________, too.

Exercises 2.10 and 2.11 What does boolean atWorldEdge() return near the middle of the world? What does it return near the edge of the world?

Exercises 2.12, 2.13 and 2.14 Were you able to make your crabs turn at the edge of the screen? What value did you settle on for the turn amount? What happened when you moved the move() statement into the if-statement block? In the Greenfoot editor, how can you determine if your braces are matched easily?

Define the following Terms in Your Own Words y y y y y y y method call parameter in sequence error message inherits void return type if-statement

This worksheet may be freely modified or distributed for educational purposes. Copyright 2011

Stephen Fornal Juan Seguin High School, Arlington TX

Page 2

You might also like