Question: 2

The following program should draw a circle on the screen

1 function start(){
2 var circle = new Circle(40);
3 circle.setPosition(getWidth() / 2, getHeight() / 2);
4 circle.setColor(Color.blue);
5 }
JavaScript
But when we run this code, we don’t see the circle. What is missing from our start function?

We never set the circle’s radius.
We need to add the line

circle.setRadius(40);
JavScript
After line 4

We are setting the position of the ball to be off the canvas.
We need to change line 3 to be

circle.setPosition(0, 0);
JavaScript

We are creating the circle incorrectly. We need to specify the width and height.
We need to change line 2 to be

var circle = new Circle(40, 40);
JavaScript

We create the circle and position it correctly on the screen, but we never add it to the screen.
We need to add the line

add(circle);
JavaScript
after line 4

We never set the circle’s radius. We need to add the line

circle.setRadius(40) after line 4