import java.awt.*; import java.applet.*; public class GraphApplet extends Applet { double f(double x) { return (Math.cos(x) + Math.sin(x/7) + 2) * getSize().height / 4; } Color bgColor = new Color(255,255,255); public void paint(Graphics g) { setBackground(bgColor); for (int x = 0 ; x < getSize().width ; x++) { g.drawLine(x, (int)f(x), x + 1, (int)f(x + 1)); } } }