A simple implementation of fractions in Java and C++.
A simple implementation of fractions, used to learn OOP in Java and C++.
The Fraction class supports:
addition, subtraction, multiplication and division (via methods in Java and operator overloading in C++)
simplification (2/4 -> 1/2)
mixed numbers (eg. 5/2 == 2 1/2)
The Fraction class currently does not support:
The Fraction class was written in Java first and then rewritten in C++. It was a learning exercise to understand how to write object-oriented code in those two languages.
The class is documented in Javadoc and Doxygen (but the docs are not shipped as of now).