/** SineWave.java uses a for loop and the PointPlotter class...
 *   @author Joel Adams, for Alice+Java.
 */

import java.awt.*; // Color

public class SineWaves {
	public static void main(String[] args) {
		SineWaves self = new SineWaves();
		self.run();
	}
	
	public void run() {
		plotSine1();
		plotSine2();
	}

	public void plotSine1() {
		Plotter plot = new Plotter(100, 100, -4, -1.5, 4, 1.5, "Sine 1");
		plot.setPenColor(Color.RED);
	    for (double x = -Math.PI; x <= Math.PI; x += 0.1 ) {
			double y = Math.sin(x);
			plot.drawPoint(x, y);
		}
	}
	
	public void plotSine2() {
		Plotter plot = new Plotter(120, 120, -4, -1.5, 4, 1.5, "Sine 2");
		plot.setPenColor(Color.BLUE);
		for (double x = plot.minX(); x <= plot.maxX(); x += plot.deltaX()) {
			double y = Math.sin(x);
			plot.drawPoint(x, y);
		}
	}
}
