Project Description
A quadratic expression is an expression with the variable with the highest power of 2. For example,
ax\textsuperscript{2} + bx + c, where a ? 0 is called a quadratic expression. Build a java program to solve a quadratic
expression in all cases, including when the roots are complex numbers. To do this, you need to set
up the following classes:
? Comp, which encapsulates a complex number.
? CompPair, which encapsulates a pair of complex numbers.
? Quad, which encapsulates a quadratic equation.
? SolveEq, which contains the main method.
Along with the usual constructors, accessors, and mutators, you will need to code additional
methods:
? In the Comp class, a method that determines whether a complex object is real.
? In the CompPair class, a method that determines whether both complex numbers
are identical.
? In the Quad class, a method to solve the quadratic equation and return a CompPair
object.
Additionally, you need to include code in the main method to solve several examples of quadratic
equations input from the keyboard. Your output should make comments as to what types of roots
we get (double real root, distinct real root, distinct complex roots.)
You should check that your code works in all four basic cases:
? The quadratic equation is a linear equation.
? Both roots are complex.
? There is a double real root.
? There are two distinct real roots.