Question: In the Testequationsstart. java file ( which you will save as Testequations. java ) , you are given an abstract class for equations in one

In the Testequationsstart. java file (which you will save as Testequations. java), you are given an
abstract class for equations in one variable: Equation. It represents an equation by the coefficient(s) of a variable
x and its powers, and has an abstract findsolution method that returns an array of double giving the root(s) of
the equation. You will write two concrete classes that extend this abstract class, as shown in the following UML
diagram:
The first class, LinearEquation, represents a linear equation of the form ax+b=0.(Thus, the coefficients array
will have two entries.) It has two constructors:
public LincarEquation(double[] coefficients)
public LinearEquation(double a, double b)// used to populate the cocficients property
Implement the
method, which will return an array of one double with the solution. Also,
implement a tastring() method that returns a string in the form ax+b- where both the numbers are
displayed with two digits to the right of the decimal point.
The second class, puadraticfquation, represents a quadratic equation of the form ax2+bx+c=0.(Thus, the
array will have three entries.) It has two constructors:
public Quadratickquation(double[] cocfficients)
public quadraticequation(double a, double b, double c)/// used to populate the coefficients property
Implement the findsolution() method, which will return:
if there are no solutions to the equation.
an array of length one giving the root of the equation if there is only one root
an array of length two giving the roots of the equation if there are two roots
Hint: Put the coefficients for the quadratic equation into variables named a,b, and c to make the code easier to
read.
Also, implement a method that returns a string in the form (ax2+bx+c-a) where all the numbers
are displayed with two digits to the right of the decimal point. Use (uatebz to produce a superscript 2 in the
output.
Use the Testequationsstart. java darr file as your starting point, and save it as Testequations . java
Here is what the output of your finished program should look like:
When You Finish
Upload the TestEquation. java file. Remember to put comments at the start of the file that give your name, the
date you wrote the code, and a description of the program. The description must be sufficient for someone who
has not read the assignment to understand what kind of input is expected, what processing occurs, and what the
output is.
In the Testequationsstart. java file ( which you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!