Answered step by step
Verified Expert Solution
Question
1 Approved Answer
When I run the following code, it brings up two errors regarding the lines for turtle 1 and turtule 2 when entering the coordinates, color,
When I run the following code, it brings up two errors regarding the lines for turtle and turtule when entering the coordinates, color, and size of the turtule. How would I fix this withot using world as the turtle's coordinates?
import java.util.;
import java.awt.;
public class CustomTurtleRunner
public static void mainString args
World world new World;
Change the constructor call below to create a large
x CustomTurtle with a green body Colorgreen
and a blue shell Colorblue at position
Move it forward to see it
CustomTurtle turtle new CustomTurtleworldColor.green,Color.blue,;
turtleforward;
Create a small x CustomTurtle with a red body
and a yellow shell at position
Move it forward to see it
CustomTurtle turtle new CustomTurtle world Color.red, Color.yellow,;
turtleforward;
Create a CustomTurtle of your own design
CustomTurtle turtle new CustomTurtle world Color.red, Color.pink, ;
turtlesetPenWidth;
turtleturnRight;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnRight;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
turtleturnLeft;
turtleforward;
worldshowtrue;
class CustomTurtle extends Turtle
private int x;
private int y;
private World w;
private Color bodycolor;
private Color shellcolor;
private int width;
private int height;
Constructor that takes the model display
@param modelDisplay the thing that displays the model or world
public CustomTurtleModelDisplay modelDisplay
let the parent constructor handle it
supermodelDisplay;
Constructor that takes the model
display to draw it on and custom colors and size
@param m the world
@param body : the body color
@param shell : the shell color
@param w: width
@param h: height
public CustomTurtleModelDisplay m Color body, Color shell, int w int h
let the parent constructor handle it
superm;
bodycolor body;
setBodyColorbody;
shellcolor shell;
setShellColorshell;
height h;
width w;
setHeighth;
setWidthw;
Constructor that takes the x and y and a model
display to draw it on and custom colors and size
@param x the starting x position
@param y the starting y position
@param m the world
@param body : the body color
@param shell : the shell color
@param w: width
@param h: he
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started