import java.awt.Color; import java.awt.Graphics; public class JParabola extends JOxy { private double a, b, c; public double f(double x) { return a * x * x + b * x + c; } public JParabola() { a = 1.0; b = 0.0; c = 0.0; } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLUE); for (int i = 0; i < getWidth() - 1; i++) { double x1 = xr(i); double y1 = f(x1); double x2 = xr(i+1); double y2 = f(x2); g.drawLine(i, yg(y1), i + 1, yg(y2)); } } public double getA() { return a; } public void setA(double a) { this.a = a; } public double getB() { return b; } public void setB(double b) { this.b = b; } public double getC() { return c; } public void setC(double c) { this.c = c; } }