Question: Why is it that when I use the getTurtleSize code the turtle goes to set location but then just spins in circles. Without calling this
Why is it that when I use the getTurtleSize code the turtle goes to set location but then just spins in circles. Without calling this method, my program works perfectly.
I am using java and the instructions are as follows:
"In the Turtle class, implement a method that returns the size and speed of the turtle in the following format: The turtle size: [size]; speed: [speed] where [size] and [speed] are the class instance variables."
This is in the Turtle Class -
public int getTurtleSize() {
return this.turtleSize;
This is in the Turtle Controller class where the print statement needs to be -
public void print() {
printStats(bigTurtle);
private void printStats(Turtle turtle) {
int turtleSize = turtle.getTurtleSize();
System.out.println("Turtle size is: " + turtleSize);
(I know the print statement is incorrect for the instructions above. I just need to know how to get the turtle size and use it on my print statement).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
