CS 111 - Program Design I
Spring 2015
Exam 1 Results
- Count: 104
- Max: 100 (x2)
- Min: 26
- Average: 76.73
- Median: 81
- St. Dev.: 15.3
Grade Distribution
- 100's: 2
- 90's: 19
- 80's: 33
- 70's: 23
- 60's: 11
- 50's: 9
- 40's: 5
- 30's: 1
- 20's: 1
Multiple Choice Answers:
- A
- D
- C
- A
- D
- A
- D
- B
- B
- C
- B
- C
- D
- B
- D
- B
- A
- D
- C
- E
Write Code Solutions
Note: Wiki loses indentation
// Question 21 public static void main (String[] args)
{
System.out.println("Begin Java Exection");
System.out.println("");
Picture p = new Picture (500, 500);
Turtle t = new Turtle (p);
t.setPenColor (Color.RED);
int i = 0;
while ( i < 4 )
{
t.forward (100);
t.turn (90);
i = i + 1;
}
t.penUp();
t.forward (20);
t.turn (90);
t.forward (20);
t.turn (-90);
t.penDown();
t.setPenColor (Color.BLUE);
i = 0;
while ( i < 4 )
{
t.forward (60);
t.turn (90);
i = i + 1;
}
p.show();
System.out.println("");
System.out.println("End Java Exection");
}
// Question 22 public static void drawStar (Turtle t, int length, Color c)
{
Color original = t.getPenColor();
t.setPenColor (c);
int i = 0;
while ( i < 15 )
{
t.forward (length);
t.turn (720/15);
i = i + 1;
}
t.setPenColor (original);
}
-- Main.troy - 2015-03-09
Topic revision: r1 - 2015-03-09 - 12:54:42 - Main.troy