Data (attributes) - all have private access double quadraticCoefficient (this is the coefficient of the quadratic term
Fantastic news! We've Found the answer you've been seeking!
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 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
Related Book For
Introduction To Probability And Statistics
ISBN: 9781133103752
14th Edition
Authors: William Mendenhall, Robert Beaver, Barbara Beaver
Posted Date: