Question: Data (attributes) - all have private access double quadraticCoefficient (this is the coefficient of the quadratic term of the polynomial) double linearCoefficient (this is the

Data (attributes) - all have private access

  • double quadraticCoefficient (this is the coefficient of the quadratic term of the polynomial)
  • double linearCoefficient (this is the coefficient of the linear term of the polynomial)
  • double constant (this is the constant of the polynomial)

Methods (behaviors) - all have public access

constructor:

  • Arguments:
    • None
  • Return
    • None
  • Behavior
    • Calls Polynomial's constructPolynomial instance method

constructPolynomial:

  • Arguments:
    • None
  • Return
    • None
  • Behavior
    • Allows user to enter the necessary coefficients and the constant term for the polynomial, and sets the attributes accordingly

functionValue:

  • Arguments:
    • double arg
  • Return
    • double
  • Behavior
    • Calculates and returns the function value using the argument arg (for example, if the user entered the polynomial 3x2 + 2x + 7, then functionValue(3) would return 40)

displaySelf:

  • Arguments:
    • None
  • Return
    • None
  • Behavior
    • Neatly displays the polynomial entered by the user

class Assignment3

Methods

public static void main(String[] args):

  • Arguments:
  • String[] args
  • Return:
  • None
  • Behavior:
  • The polynomial is constructed
  • The user is asked for the argument to the function
  • The polynomial is displayed
  • The function value (based on the argument and Polynomial entered) is displayed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on the description provided heres an example implementation of the Assignment3 class and the P... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!