1. Write a Java class for rational numbers. Each rational number have a nominator and a denominator, both represented as integers. Rational number can also be positive or negative. Your class should support basic rational number asthmatics such as addition, subtraction, multiplication. You should use your GCD code to remove the common factors in the nominator and denominator when possible. Test your code with different test cases.
2. In the class, we construct a dynamic array class. The implementation is efficient for pushBack and popBack, but not efficient for pushfront and popFront. We can use a circular data structure to solve the problem. Internally, it is still an array, but from outside, the data structure looks like a circle: you have a front index and a back index and the front index moves backwards ( counter-clockwise) and back index moves forward (clockwise). Now we can make both the pushBack and pushFront efficient. Your data structure should support methods such as isEmpty, getItem, setItem. Implement the circular array data structure in Java. Implement TWO classes: one for a fixed size circular array and the other a dynamic circular array that can resize itself when necessary.