CSE 382 Algorithms and Data Structures
Barbara Nostrand, Ph.D.
Electrical Engineering and Computer Science
The goal of this project is to improve your understanding of classes and objects and to introduce graphics.
|Read||Section C.2 of the text for a discussion of simple Graphics methods. |
Controlling Access to Members of a Class.
|Simple Example||Download, compile, and execute the rectangle drawing program Rectangle.java|
Here is a working copy of of Phasor.java. You will need to compile and save it in the same directory as your version of Complex.java.
Warning: You must make sure that your Complex.java file employs the same: method names, parameter type patterns, return types, and access privileges (public/private) as those specified in Phasor.java in order for them to work together. Otherwise, you will experience mysterious compiler errors. Consequently, you will need to modify the Complex method names and parameter lists in Phasor.java in order for it to work with the version of Complex.java specified below. Remember that Java is case sensitive.
|New Class||Create a Complex class which implements complex numbers.
You need to implement three consturctors and nine basic accessor methods:
Note 2. externalValue is the name for a Complex valued parameter passed by the method call.
Note 3. The complex conjugate of a complex number is computed by inverting the sign of its complex component.
Note 4. The magnitude of a complex number z is equal to the Euclidean distance from z to the origin. This value is calculated by using the Pythagorean theorem.
Note 5. The multiplicative inverse of a complex number z is equal to to the complex conjugate of z divided by the magnitude of z.
Your program should do the following things:
You will complete this project with your lab partner.
You may implement your system as a Java application. You may use Jgrasp. Do not use netbeans or produce a Java applet.
You must each turn in a complete software sources and an executable electronic version of your software including test routines. Your software must be in a single directory/folder as a collection of Java source and class files. You must not turn in jar files.