Exercise Set 9: Loops with Counters

Exercise 9.1 Design the class ArrayAlgorithms. Its member data is an array on Comparable objects. Develop the following methods for this class:

Write the tests for these methods in the test suite.

Test your code on arrays of Strings and arrays of Integers.

Exercise 9.2 The given code specifies a Double2Double interface and a Plot class. The constructor for the Plot class consumes Rectangle2D object which specifies the region for the display of the function graph. The Plot class also includes the methods plotAxes() which plots the axes for the graph, and plotValue(double x, double y) which plots the value y for the point x.

Write the class FunctionPlot as follows. The member data specify the function to plot - an object in the class which implements the Double2Double interface. Develop the following methods in the class FunctionPlot:

Exercise 9.3 This is an independent continuation of the previous exercise. Develop the method integral which for the given (double) interval (x1, x2) computes the value of the integral of this function, approximated to the value of a given epsilon.