In this assignment, students demonstrate their understanding of classes and implementing mathematical ideas with object-oriented programming concepts by writing a class that represents a rational number. Students maintain information about the rational number, noting that the number is represented in its reduced form at all times (for which students need to write a recursive subroutine to find the GCD of two integers). Students implement several methods to perform arithmetic operations on rational numbers.
For more information on how this homework fits within the scope of the course, please see the following course schedule and syllabus here: (http://mathcs.pugetsound.edu/~aasmith/cs161/). Search "Rational Object"
By putting the implementation of classes in the context of a common basic mathematical construct, this activity creates a Meaningful and Relevant Context.