Having had our first exposure to the basics of Java programming, we’ll now turn our attention to building our programming skills. In this reading you’ll learn about the Turtle class and some of its capabilities (also known as methods
). Following your reading and our class discussion, you should feel comfortable creating turtles (and the worlds they live in) and moving them around the screen in various ways.
Sections 3.1-3.4 (pp. 38-50) from the course textbook.
Each student will be responsible for learning and demonstrating proficiency in the following objectives PRIOR to the class meeting. The reading quiz will test these objectives.
World
(or Turtle
) object.The following objectives should be mastered by each student DURING and FOLLOWING the class session through active work and practice.
=
” is different in Java than it is in math.These exercises are geared towards mastering the BASIC learning objectives listed above. You are expected to submit them before class and it is highly recommended that you complete them before attempting the reading quiz.
Textbook Problem: 3.3
Write Java code to create one world object and two turtle objects. The first turtle should start in the default location (the center of the world) while the second should start at the coordinates (25, 75).
Your answer should contain the code you entered into the Interactions Pane and either a screenshot or a drawing ofa box showing the world then put dots where the turtles will be when they start.
Assume you have the following Java code:
String s = "Hello!";
The String class has a method named length
that gives us the number of characters in the string. The length
method doesn’t have any parameters. Write an expression that invokes the length
method. Hint: This should be pretty similar to invoking the turnLeft
method on a turtle object.