To provide integration with UML we will use the plugin Omondo EclipseUML, which is a visual modeling tool that supports the creation of UML diagrams, reverse engineering and other functions. If you don't have it you can download the free version from the site www.omondo.com.
Once installed, follow these steps:
1) Using the EclipseUML tool,
create a Class Diagram for the classes you created in the last
laboratory assignment (Complex
and
Fraction
) and the interface
BasicOps
. Include the classes
Number
and Object
in the
appropriate places.
2) Compile and run the generated classes. Did you prefer using UML for creating the files or the code editor? Why?
3) Now, select the project where
the code for the classes Fraction
and
Complex
is. Generate automatically a Class
Diagram for the two classes and for the interface
BasicOps
.
4) Define a new interface called
FourOps
:
public interface FourOps { // Add a number to this number public void add(Number a); // Subtract a number from this number public void sub(Number b); // Multiply a number to this number public void mult(Number a); // Divide this number by public void div(Number b); }
Declare that Complex
and
Fraction
implement the
FourOps
interface using the EclipseUML
tool. After this, generate the code and finish the coding using the
editor.
5) Which interface is better?
BasicOps
or
FourOps
? Why?
6) Which was easier to implement? Why?
Hand in all material you created.
Copyright © 1998-2009 Dilvan Moreira