Assigned: Monday, January 26, 1998
Due: 11am, Tuesday, February 3, 1998
Summary. An important concept in object-oriented
design is information hiding: someone who uses your class
need know only what your class does and not how
it does it. In this exercise, you will work on reimplementing
Complex class while maintaining its interface.
Expectations. You are expected to turn in a working, well-commented, and well-tested version of this assignment. The class you turn in should have at least the same functionality (methods provided and meanings of those methods) as the original class. Make sure to turn in your test procedure(s) as well as your new class.
After some time "in the field", you observe that the
Complex library we developed is more frequently used for
angle/radius computations, rather than real/imaginary computations.
Hence, you have decided that the library would work more quickly if you
rewrote the class to use angle and radius as the core attributes.
Your goal is to rewrite the library in such a way that the angle- and
radius-based methods perform significantly more quickly, presumably at
a cost for the real-part- and imaginary-part-based methods. In particular,
getRadius should not require any
However, since a number of people are using your library (or we are assuming that a number of people are using your library), you are not allowed to modify the meaning of any of the existing functions. You may find this difficult or counter-intuitive at points, but you'll need to live with it.
If you deem it appropriate, you may also add methods to your library.
More details forthcoming.
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Mon Jan 26 07:43:12 1998.
This page generated on Tue Jan 12 11:44:33 1999 by SiteWeaver.
Contact our webmaster at firstname.lastname@example.org