forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmartShapes.java
More file actions
43 lines (20 loc) · 1.03 KB
/
SmartShapes.java
File metadata and controls
43 lines (20 loc) · 1.03 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
package section2;
import org.jointheleague.graphical.robot.Robot;
public class SmartShapes {
public static void main(String[] args) throws Exception {
// Make a new Robot
// Put the robot's pen down
// Make the robot move as fast as possible
// COUNT. Create an int variable that will count how many sides of the shape we have drawn.
// The start value will be zero because no sides have yet been drawn. Use this code:
/** int sides = 0; **/
// Start a while loop to repeat the MOVE, TURN, and COUNT code 4 times
// MOVE your robot 200 pixels
// TURN the robot 90 degrees to the right
// COUNT. Add one to the number of sides the robot has drawn sides+=1;
// End the while loop here
// Run the program. You should see a square
// Now change the code to draw a different shape
// e.g. triangle (3-sides), pentagon (5-sides), decagon (10-sides)
}
}