Data Abstractions: Rational numbers

October 8th, 2015

Screen Shot 2014-09-15 at 8.43.34 PM

An immutable data type has the property that the value of an object never changes once constructed.

An assertion is a boolean expression that you are affirming is true at that point in the program.

Use Creative Problem Rational numbers as a template to implement Complex.java as an immutable data type that supports addition, subtraction, and multiplication.

Challenge: implement the division operation.

Homework:
Read more on Asserstions and Inmutability.

 

 

 

 

Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne, Addison-Wesley Professional, 2011, ISBN 0-321-57351-X