Lecture 9 Objectives [Nov 07]prev next

MUSICAL COMPOSITION: Rachmaninoff, Piano Concerto No. 2 in C minor, as played by Arcadi Volodos
Movement I (10:06) Movement II (09:56) Movement III (10:06) Movement IV (05:42)


At the end of today's class you should

HAVE READ:

KNOW:

BE ABLE TO:

DAILY QUESTION:

 


Sample Exam Question:

Design a class Point that represents a point (x, y) in Cartesian coordinates with integer x and y. Include methods setX(int x) and setY(int y) as methods to update (respectively) the x and y values of a Point object. Include methods getX() and getY() to retrieve the values of x and y (respectively). Include a method vectorLength() which returns a double value representing the distance from the Point to the origin (0,0).

Using the Point class, write a program PointTest that instantiates a point object and modifies it to represent the point (3, 4) in the Cartesian plane. Confirm that the getX() and getY() methods work as expected. Confirm that the method vectorLength() returns 5.0 as expected. Confirm that invoking setX(2) followed by setY(2) updates the point object so its x and y values are properly changed.