Question: Polynomial Addition I need help adding two polynomials a and b to obtain the sum c = a + b. You will use the following
Polynomial Addition
I need help adding two polynomials a and b to obtain the sum c = a + b. You will use the following representation to store a and b.
import java.util.ArrayList; public class AddTwoPolynomials { public static void main(String[] args) { private double coeff; private int exp; public AddTwoPolynomials( double c, int e){ coef = c; exp = e; } // constructor public void add ( double c, int e){ coef = c; exp = e; } // assign values to the coefficient and exp. public double getCoef () { return coef; } public int getExp () { return exp; } } }
Use the Java built-in ArrayList class - import java.util.ArrayList;
I created the skeleton code for your use, please solve if possible and explain how you solved it in code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
