Create a new folder called CSCI130_A3_yourname. Createall of the files indicated below within this folder.
For this assignment you will be creating a total of 2 classesthat meet the definitions below. This assignment will allow theuser to enter in the coefficients for a polynomial function ofdegree 2. The user will then be asked to enter a number. Theprogram will use that number as an argument to the function, andwill print the corresponding function value.
Keep in mind that a second degree polynomial function in generalform looks like:
   f(x) = ax2 + bx + c (here 'a' isthe coefficient of the quadratic term, 'b' is the coefficient ofthe linear term, and 'c' is the constant)
Refer to the image at the bottom of this page to get a betterunderstanding of the logic flow.
CLASSES:
- Polynomial - this class should be in a file namedPolynomial.java
- Assignment3 - this class should be in a file namedAssignment3.java
CLASS DEFINITIONS:
class Polynomial
Data (instance variables) - all have privateaccess
- double quadraticCoefficient (this is the coefficient of thequadratic term of the polynomial)
- double linearCoefficient (this is the coefficient of the linearterm of the polynomial)
- double constant (this is the constant of the polynomial)
Methods (behaviors) - all have publicaccess
constructor:
- Arguments:
- Return
- Behavior
- Calls Polynomial's constructPolynomial instance method
constructPolynomial:
- Arguments:
- Return
- Behavior
- Allows user to enter the necessary coefficients and theconstant term for the polynomial, and sets the attributesaccordingly
functionValue:
- Arguments:
- Return
- Behavior
- Calculates and returns the function value using the argumentarg (for example, if the user entered the polynomial 3x2+ 2x + 7, then functionValue(3) would return 40)
displaySelf:
- Arguments:
- Return
- Behavior
- Neatly displays the polynomial entered by the user
class Assignment3
Methods
public static void main(String[] args):
- Arguments:
- Return:
- Behavior (see image below for clarification):
- 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 Polynomialentered) is displayed
After writing the code, do the following:
- Compile and execute the code. Fix any errors that occur ateither stage. Continue this process until the program runscorrectly.
- Document the code by putting your name, the date, assignmentnumber, and instructor in comments at the top of the Driver.javafile.
- Submit your assignment be either:
- uploading both files within the CSCI130_A3_yournamefolder to Canvas
OR - zipping the entire CSCI130_A3_yourname folder anduploading the zipped file to Canvas