import java.awt.*; public class SineWave { double wavelength; double amplitude; double phase; public SineWave(double wavelength, double amplitude, double phase) { this.wavelength = wavelength; this.amplitude = amplitude; this.phase = phase; } public void advance(double phaseIncrement) { // note: this advances the initial phase, so a positive value // moves the wave form to the left, negative to the right. this.phase += phaseIncrement; } public void setPhase(double phase) { this.phase = phase; } public float getPhase() { return (float)this.phase; } public void setAmplitude(double amplitude) { this.amplitude = amplitude; } public float getAmplitude() { return (float)this.amplitude; } public void setWavelength(double wavelength) { this.wavelength = wavelength; } public float getWavelength() { return (float)this.wavelength; } public int getY(int x) { double degreesPerPixel = 360.0 / wavelength; double degrees = phase + x*degreesPerPixel; return (int)(amplitude*Math.sin(degrees*Math.PI/180.0)); } public void drawThick(Graphics g, int x, int y, int width) { double degreesPerPixel = 360.0 / wavelength; int yOffset = (int)(amplitude/2.0)+2; double degrees; int xloc; int yloc; for (int i=0; i