CS 1401, Quiz 9

Date: Monday, November 6, 2006
Name (please type legibly, ideally in block letters): ______________________________________________________________________

Motivation: One of the main uses of computers in calculus is to provide graphical description of different functions. The graphical representation of a graph y = f(x) is formed by different points with coordinates (x, y = f(x)).

Task:

1. Define a class Point in which each object has two real-valued coordinates x and y. Do not forget to include a constructor, accessor methods, and mutator methods.

2. In the main method, define an array of 100 points, in which the i-th point has coordinates x = i/100 and y = x^2.

3. Trace your code for the first two points, with x = 0 and y = 0, and with x = 0.01 and y = 0.0001.

Comment: your code will be helpful in plotting a quadratic function y = x^2.