forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFourSquare.java
More file actions
executable file
·48 lines (27 loc) · 1.11 KB
/
FourSquare.java
File metadata and controls
executable file
·48 lines (27 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package section2;
import javax.swing.JOptionPane;
import org.jointheleague.graphical.robot.Robot;
public class FourSquare {
// Create a new Robot
void go() {
// Make the robot move quickly (setSpeed)
// Set the robot's pen width to 5
// Put the robot's pen down
// This numberOfSquares variable will track how many squares the robot has drawn
// It's set to zero here, because the robot hasn't drawn any squares yet.
int squaresDrawn = 0;
// LOOP: Start a while loop to repeat the following code until 4 squares have been drawn:
// PEN COLOR. Set the pen color to random setRandomPenColor()
// DRAW A SQUARE. Call the drawSquare() method. Have you put some code in it?
// TURN. Turn the robot 90 degrees to the right
// INCREASE COUNT. Add one to the number of squares drawn
// End the loop here
}
void drawSquare() {
System.out.println("Yay! you called the drawSquare() method!");
/* Put code here to draw one square - don't forget to use a loop! */
}
public static void main(String[] args) {
new FourSquare().go();
}
}