Harvey Mudd College
Computer Science 60
Fall 2012
Hw7, part1


The Quantity class

In essence, this problem asks you to implement (really "port") Unicalc from Racket into Java. You'll do this by implementing a Quantity class, representing Unicalc's quantity lists. That, in turn, will use your OpenList as its fundamental data structure. This is natural, because OpenList is a Java implementation of Racket lists!


Part 1: Unicalc in Java via Quantity

This problem asks you to implement Unicalc in Java.

The implementation will be in the Quantity class.
In order to ensure that toString and other important methods are uniform, there is a starter file for Quantity.java in the hw7.zip archive:

                    hw7.zip

In that zip archive are three files:

Note that you'll need to copy your OpenList.java into the folder containing Quantity.java. The Quantity class uses OpenList as an essential part.

Notes on Quantity    


Additional Notes

Presuming the numerators and denominators are sorted    The constructors of Quantity should make sure that the numerator and denominator units are in alphabetical (sorted) order. Our starter file provides this functionality. You will need mergesort working in your OpenList class.

Testing your code    For testing we've provided a set of tests that are commented out in main.

In addition, the file QuantityTester.java has a set of tests that you'll be able to compile and run once Quantity's methods are written.