CSci 150: Foundations of computer science I
Home Syllabus Assignments Tests

printable version

Quiz 1 Review

[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

Problem Q1r.1.

Suppose the computer executes the below program fragment, with the user typing 50 when prompted. Sketch what path will be left in the window when the program reaches its end.

double x;
x = this.readDouble();
Turtle t;
t = new Turtle(10, 100);
t.forward(x);
t.left(90);
t.forward(20);
t.right(90);
t.forward(x);
t.hide();