The method drawSquare is an illustration of functions; functions are named program statements that are executed when called
The method drawSquare written in Java, where comments are used to explain each action is as follows:
//This defines the function
public static void drawSquare(int x, int y, int len) {
//This checks if x + len exceeds 10
if(x+len>10){
len = 10-x;}
//This checks if y + len exceeds 10
if(y+len>10){
len = 10-y;}
//The next four lines draw the square
drawLine(x, y, x+len, y);
drawLine(x+len,y,x+len,y-len);
drawLine(x+len, y-len, x, y-len);
drawLine(x, y-len, x, y);
}
Read more about java programs at:
https://brainly.com/question/19271625