import java.awt.Graphics; import javax.swing.JApplet; public class Parabola extends JApplet { @Override public void paint(Graphics g) { super.paint(g); double a = -0.0025, b = 1, c = 0; for (int x0=0; x0<200; x0+=10) { double y0 = a * x0 * x0 + b * x0 + c; int x1 = x0 + 10; double y1 = a * x1 * x1 + b * x1 + c; g.drawLine(x0, (int)y0, x1, (int)y1); System.out.printf("(%d, %.1f) -- (%d, %.1f)", x0, y0, x1, y1); } } }