Assignment 2

Due date: Thursday, Octomber 31, in the lab.
NOTES:
This assignment requires JAVA object oriented techniques. You will practice ArrayList and LinkedList data structures.

Problem description

In this assignment, you will implement a POLYNOMIAL project using LinkedLists. Specifically, you need to use the Java List ADT as the basis for creating an implementation of a new ADT called Polynomial. Your project creates, manipulates, and evaluates polynomials of arbitrary degrees.

Requirements:

  1. You will begin by creating a Polynomial class. Each polynomial object needs to store the coefficients (or terms) of the polynomial that it represents. The Polynomial class will store the coefficients in a LinkedList of Double objects (recall generics). The length of the list will determine the degree of the polynomial, and the order of the coefficients in the list will correspond to the terms in decreasing order of degree.
  2. Your class/project needs to allow a user to create a polynomial in three ways: (1) with no terms, (2) by reading the terms from a file and (3) from the command line. For example, the following sequence of terms indentifies the polynomial of degree 5, 4X^5 + 5X^3 + 7X^2 + 3: 4 0 5 7 0 3
  3. The user can input as many polynomials as (s)he desires. The polynomials are store internally by your program into an ArrayList, E.g., ArrayList <Polynomial>.
  4. The user can select to work with one or two polynomials at a time. You must display the polynomials and allow the user to select the ones (s)he wants to work with.
  5. Your class and project need to allow the user to EVALUATE a polynomial at a given double value. E.g., the above polynomial evaluates to 405,703 at point x = 10.
  6. Your polynomial class needs to implement methods to allow the user to (1) sum two polynomials, compute the difference between two polynomials, and multiply a polynomial by a scalar. The result of any of these operations produces a new polynomial, which you need to append to your ArrayList of polynomials.
  7. Polynomial Output: Your program must allow the user to print a polynomial in three formats (use the caret (^) symbol to denote exponentiation):
    • CANONICAL FORM DECREASING ORDER OF DEGREES. E.g., 7X^3 - 5X + 1
    • CANONICAL FORM INCREASING ORDER OF DEGREES. E.g., 1 - 5X + 7X^3 (Do not store the polynomial in another data structure! Need to traverse the LinkedList multiple times. This will help you understand the difference between this single linked lists and double linked list.)
    • SHOW ALL COEFFICIENTS. E.g., 7X^3 + 0X^2 + (-5)X + 1
Bonus Points: Develop a user interface for the project.