forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStarShow.java
More file actions
executable file
·64 lines (35 loc) · 1.62 KB
/
StarShow.java
File metadata and controls
executable file
·64 lines (35 loc) · 1.62 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
49
50
51
52
53
54
55
56
57
58
59
60
61
package section2;
import org.jointheleague.graphical.robot.Robot;
/*** Teacher's note ***/
/* Before beginning recipe:
* 1. ask students to find and explain the method in this recipe.
* 2. ask students how they might use the method to make the picture in the laminated hand-outs. */
public class StarShow {
Robot robot = new Robot("batman");
void makeStars() {
drawStar(150); //5. delete this line. You will draw the star again in step 8.
// 13. Set the speed to 8
// 6. Make a variable to hold the X position of the Robot and set it to 10
// 7. Make a variable to hold the Y position of the Robot and set it to 600
// 8. Make a variable to hold the star size and set it to 25
// 12. Use a for loop to repeat steps #19 to #18, 30 times
// 19. Set the pen width to i
// 10. Set the X position of the robot to your X variable
// 11. Set the Y position of the robot to your Y variable
// 9. Call the drawStar() method with your star size variable
// 14. Increase the value of the X position variable by star size. See Figure 2
// 15. decrease the value of the Y position variable by star size. See Figure 3
// 16. Increase the star size by 20
// 17. Turn the robot 12 degrees
// 18. Make each star a different random color like in Figure 4
}
private void drawStar(int starSize) {
// 2. Put the robot's pen down
// 4. Repeat both commands 5 times. See Figure 1 at http://bit.ly/star-show
// 1. Move the robot the distance of the starSize variable
// 3. Turn the robot 144 degrees
}
public static void main(String[] args) {
new StarShow().makeStars();
}
}