SWE/CS 332 In Class Exercise # 8
September 25, 2017


Name(s):

Here is a fragment of Liskov's Poly.java example:
    // Overview:  Polys are immutable polynomials c0 + c1x + c2x^2 + ...
    int[] trms; int deg;   // the representation
  1. What is the abstraction function for this implementation?


  2. What is the rep-invariant appropriate for this implementation?

Repeat for the MapPoly.java implementation:
    // Overview:  Polys are immutable polynomials c0 + c1x + c2x^2 + ...
    TreeMap<Integer, Integer> trms;