Lab 33 B
Lab 33 B
Assignment Purpose:
The purpose of this program is to demonstrate knowledge of the Java syntax that is required to
create and traverse a simple linked list, which is created with dynamic memory allocation.
Write a program that will evaluate polynomial functions of the following type:
This program has to be written, such that each term of the polynomial is stored in a linked list node.
You are expected to create nodes for each polynomial term and store the term information. These
nodes need to be linked to each previously created node. The result is that the linked list will access in
a LIFO sequence. When you display the polynomial, it will be displayed in reverse order from the
keyboard entry sequence.
80 Point Version
This program has a 80 point and a 100-point version. The 80-point version displays the contents of
each polynomial term, and is not concerned with normal mathematical appearance. The result is a
polynomial display like:
The 100-point version makes the display follow mathematical conventions and does not display terms
with zero coefficients, nor powers of 1 or 0. The polynomial example, above, is shown again as it would
appear with the 100-point version.
Y = 1 + X^3
// Lab33bst.java
// The student version of the Lab33b assignment.
import java.io.*;
class PolyNode
{
Y(2) = 57
Y(2) = 57
Y = 5 + X^4
Y(2) = 21