/* Listing0914.java */

class MathExp
implements DoubleMethod
{
  public double compute(double value)
  {
    return Math.exp(value);
  }
}

class MathSqrt
implements DoubleMethod
{
  public double compute(double value)
  {
    return Math.sqrt(value);
  }
}

class Times2
implements DoubleMethod
{
  public double compute(double value)
  {
    return 2 * value;
  }
}

class Sqr
implements DoubleMethod
{
  public double compute(double value)
  {
    return value * value;
  }
}

public class Listing0914
{
  public static void printTable(DoubleMethod meth)
  {
    System.out.println("Wertetabelle " + meth.toString());
    for (double x = 0.0; x <= 5.0; x += 1) {
      System.out.println(" " + x + "->" + meth.compute(x));
    }
  }

  public static void main(String[] args)
  {
    printTable(new Times2());
    printTable(new MathExp());
    printTable(new Sqr());
    printTable(new MathSqrt());
  }
}