Course Level
CS1
Knowledge Unit
Fundamental Programming Concepts
Collection Item Type
Assignment
Synopsis

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.

Recommendations

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"
 

Engagement Highlights

By putting the implementation of classes in the context of a common basic mathematical construct, this activity creates a Meaningful and Relevant Context.

Engagement Practices Employed

Computer Science Details

Programming Language
Java

Material Format and Licensing Information

Creative Commons License
CC BY-NC-SA