Question

Part 1: Immutable Classes

Implement classes Vector3 and Matrix3 in the package eecs2838.1ab3 that represent immutable classes for a 3-component vector and a 3 x 3 matrix. See the documentation contained in the

class files.

• Try to use constructor chaining to implement the required constructors whenever

possible.

• Think about how the immutability is ensured whenever you implement any methods or

constructors

• If you cannot complete one or more of the methods, at least make sure that it at least

returns some value of the correct type; this will allow the tester to run, and it will make it

much easier to evaluate your code. For example, if you are having difficulty with

hashCode then make sure that the method returns some numeric value.

• You are encouraged to explore the features of the Arrays class, in particular copyof, as

well as the System class-arraycopy.

JUnit testers for your classes are available in the project that you downloaded. Note that the

testers are not very thorough, and may not catch all the errors you might make. Also note that passing all of the tests in this tester does not guarantee a good solution (in other words, you should think critically about your implementation for each method).

Part 2: Utility Class

Complete the implementation of the Math class. Refer to the method's description in the

JavaDoc in-code comments. In case you need to refresh your knowledge of vectors, matrices, and operations involving them, feel free to consult your favourite math textbook or the numerous online resources.

A JUnit tester class for this part contains only two methods (testing matrix-matrix

multiplication). Complete the other unit tests to be able to test the other newly implemented

methods.