// Copyright (c) 1996, 1997, 1998 Bruno R. Preiss, P.Eng. // $Author: brpreiss $ // $Date: 1998/12/14 02:57:41 $ // $RCSfile: Application4.java,v $ // $Revision: 3.3 $ package Opus5; import java.util.NoSuchElementException; /** * Application program that illustrates the implementation of polynomials * as sorted lists. * @see PolynomialAsSortedList * @author Bruno R. Preiss, P.Eng. * @version $Id: Application4.java,v 3.3 1998/12/14 02:57:41 brpreiss Exp $ **/ public class Application4 { //[ final String copyright = "@(#) Copyright (c) 1998 by Bruno R. Preiss, P.Eng."; //] /** * Creates several polynomials and adds them. * @param args The command-line arguments. Ignored. **/ public static void main (String[] args) { Polynomial p1 = new PolynomialAsSortedList (); p1.add (new Term (4.5, 5)); p1.add (new Term (3.2, 14)); Terminal.out.println (p1); Polynomial p2 = new PolynomialAsSortedList (); p2.add (new Term (7.8, 3)); p2.add (new Term (1.6, 14)); p2.add (new Term (9.999, 27)); Terminal.out.println (p2); Polynomial p3 = p1.plus (p2); Terminal.out.println (p3); } }