import java.awt.*;
import java.applet.*;
public class SinCos extends Applet
{
Turtle t;
public void paint(Graphics g)
{ t = new Turtle(this, 100, 150, 0);
zeichne(); // Hauptprogramm
}
void zeichne()
{ t.setzeKOS(-2*Math.PI, 2*Math.PI, -1, 1);
t.stiftfarbe(Color.red);
zeichneSinus();
zeichneCosinus();
} // zeichne
void zeichneSinus() // mit Strecken
{ double xalt = -2*Math.PI;
double yalt = Math.sin(xalt);
double y;
for (double x=-2*Math.PI; x <= 2*Math.PI; x = x+0.01)
{ y = Math.sin(x);
t.strecke(xalt, yalt, x, y);
xalt = x;
yalt = y;
}
} // zeichneSinus
void zeichneCosinus() // mit dicken Punkten
{ double y;
for (double x=-2*Math.PI; x <= 2*Math.PI; x = x+0.01)
{ y = Math.cos(x);
t.dickPunkt(x, y, 4);
}
} // zeichne Cosinus
} // class SinCos
Hier geht es weiter ...