Do you Know? - Part 2 GridWorld Case Study

advertisement
Do you Know? - Part 2 GridWorld Case Study
Name: _________________________________________________Date: _______
The source code for the BoxBug class is in Appendix C.
1. What is the role of the instance field sideLength ?
___________________________________________________________________________
___________________________________________________________________________
2. What is the role of the instance field steps ?
___________________________________________________________________________
___________________________________________________________________________
3. Why is the turn method called twice when steps becomes equal to sideLength ?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
4. Why can the move method be called in the BoxBug class when there is no move method in
the BoxBug code?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
5. After a BoxBug is constructed, will the size of its square pattern always be the same? Why
or why not?
___________________________________________________________________________
___________________________________________________________________________
© 2007 The College Board. All rights reserved. Visit apcentral.collegeboard.com (for AP professionals)
and www.collegeboard.com/apstudents (for AP students and parents).
6. Can the path a BoxBug travels ever change? Why or why not?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
7. When will the value of steps be zero?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
© 2007 The College Board. All rights reserved. Visit apcentral.collegeboard.com (for AP professionals)
and www.collegeboard.com/apstudents (for AP students and parents).
Download