QuestionQuestion

Transcribed TextTranscribed Text

Description: Create a class called Polynomial for performing arithmetic with polynomials. In mathematics, a polynomial is an expression consisting of variables and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents. A polynomial in a single variable X can always be written in the form: anx" +an-12n-1 + + a2x2 + aix + ao where are constants and X is the variable. 3x² 5.c + 4. Polynomial must provide the followings: term term term 1 2 3 Constructors: Polynomial (double[]] a) - Polynomial p1 = new Polynomial (new double[]{4, -5, 3}); Polynomial (list of doubles) - Polynomial p2 = new Polynomial(3, -5, 4); // observe ordering Copy constructor Mutator/accessor: set (double[[ a) - new coefficients get() - copy of the coefficients equals - compare n toString - return "3x^2 - 5x + 4" aix i f (double x) - evaluate and return the value of the polynomial i=0 Polynomial. add(Polynomial lhs, Polynomial rhs) - polynomial addition, returns a polynomial main - test all the features of the class Require I/O: F. Last 's Polynomials Test output F. Last is your first initial and last name. You must format the program input and output exactly as shown. Shaded texts are your program execution time I/O.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

/**
* Name: Last, First
* Project:
* Due:
* Course:
* Description:
* This class implements a Polynomial object
* which realizes a representation of a Polynomial
* and performs arithmetic with Polynomials.
*/

public class Polynomial {

//field storing coefficients
private double[] a;

// Redundant Constructor with Array input (list accepts array)
//public Polynomial(double[] a) {
//    set(a);
//}

// Polynomial constructor accepting list of coefficients
public Polynomial(double... a) {
    set(a);
}

// Polynomial constructor copying another Polynomial object
public Polynomial(Polynomial other) {
    this(other.get...

By purchasing this solution you'll be able to access the following files:
Polynomial.java.

$30.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats