CS 1713 Introduction to Computer Science: Spring 2007


Problem from class on 4/18/07:


Draw an accurate schematic diagram of the program variables showing the execution of the program:

double x = 2;
double y;
double[] z;
double[] w = {4,8};
y = x;
z = new double[3];
z[0] = x + 1;
z[1] = y + 5;
y = y + 3;
z[2] = y;
x = w[0];
w = z;
y = w[0];

Solution: