changes made:
redesign the slits to be 2 instead of the older single slit
made the 2 slits symmetric centered with moved by y slider
add the 2 slits scalarField by introducing the idea of superposition from the top set of secondary sources
[code]for(int i=0;i yc=yi+i*dy; // lay the source in y
yctop=yitop+i*dy; // duplicate for top slit
ycc[i] = yi+i*dy; // by lookang for drawing source
 ycctop[i] = yitop+i*dy; // by lookang for drawing source
for(int j=0;j //  if (x     x=xmin+j*d;
//    }
//    else if (x>x1){
//   x=x1+j*d;
 // r=x-x1; // r is distance from array point x to slit position x1
//   x2=(x-xc)*(x-xc);
//   }
 for(int k=0;k   y=ymin+k*d;
 
  if (x      r=x-x1; // r is distance from array point x to slit position x1
      zsum[j][k]=Math.sin(kw*r-omega*t)*n; // need n to compensate for the magnitude
    }
 else if (x>=x1){
  r=Math.sqrt((x-xc)*(x-xc)+(y-yc)*(y-yc));
  rtop=Math.sqrt((x-xctop)*(x-xctop)+(y-yctop)*(y-yctop));
  zsum[j][k]+=Math.sin(kw*r-omega*t)+Math.sin(kw*rtop-omega*t);
  }
 
 }
}
}[/code]

add path difference tools to allow sense making that when path difference = integer of wavelength, correspond to constructive interference. and 1/2 of integer is destructive interference like in Ejs Open Source Ripple Tank Interference Model java applet http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2067.0

17 october 2011
add d separation = ycentre2*2 to align with teaching and learning

this simulation is made possible by the open source codes shared by Fu-Kwun Hwang, the true master teacher!

enjoy!