import java.awt.*; // for Polygon public abstract class Ch15_1 // demonstrate the creation of an abstract class, this class will represent a generic function f that { // can be used to generate the x,y coordinates that the function computes, that is y=f(x) protected Polygon p=new Polygon(); // instance datum to be inherited public Ch15_1() { // no arg constructor causes the Polygon p to get values drawFunction(); } public void drawFunction() { // method to compute the polygon by generating f(x) values for x between -100 and +100 for(int x=-100;x<=100;x++) p.addPoint(x+200,200-(int)f(x)); // we call the function f, which will be defined in each child } public abstract double f(double x); // abstract method needs to be implemented in child classes public Polygon getPoly() {return p;} // accessor to get the polygon }