CMPS 13H: Honors Introduction to Programming and Data Structures

Programming Assignment #3: Polynomials


Remember: your programming assignment must be turned in online.

The Basics

The goal of this program is to create a class (called Polynomial) to represent polynomials. Polynomials have the form

ai*xi + ai-1*xi-1 + ... + a1*x1 + a0

You should include methods for modifying coefficients, and adding, subtractying, and multiplying polynomials. Your class should include two constructors, one that specifies the degree of the polynomial, and one that simply supplies an array of doubles to use as coefficients. Your class should also include a method to evaluate the polynomial at a particular point, and a toString() method.


The Details

Your class should represent a polynomial as an array of coefficients. Recall that

axi + bxi = (a+b)xi

and

axi * bxj = (a*b)xi+j.

Your program must be accompanied by a one page ASCII document (.txt format) that shows your design:

  1. Inputs
  2. Outputs
  3. Data objects and all non-trivial operations on those data objects
  4. Algorithm(s)

Your program must also contain clear and descriptive variable names and comments, and good formatting that enhances the clarity of the program.


What to turn in

Your java program (called Polynomial.java) and your design document (called Design.txt).

REMEMBER: Do not submit object files, assembler files, or executables. Every file in the submit directory that could be generated automatically by the compiler or assembler will result in a 5 point deduction from your programming assignment grade.


sbrandt@cse.ucsc.edu