Numbers
Class QuadraticEquation

java.lang.Object
  extended by Numbers.QuadraticEquation

public class QuadraticEquation
extends java.lang.Object

Calculates solutions to the quadratic equation. Also calculates whether there are real solutions or not.

Author:
Chris Hamner

Field Summary
private  double a
          first variable in equation
private  double b
          second variable in equation
private  double c
          third variable in equation
private  double x
          used to return first solution
private  double y
          used to return second solution
 
Constructor Summary
QuadraticEquation(double a, double b, double c)
          Constructs a new QuadraticEquation problem.
 
Method Summary
 double getSolution1()
          Calculates and returns the first solution to the problem.
 double getSolution2()
          Calculates and returns the second solution to the problem.
(package private)  boolean hasSolutions()
          Determines whether the problem has any real solutions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

private double a
first variable in equation


b

private double b
second variable in equation


c

private double c
third variable in equation


x

private double x
used to return first solution


y

private double y
used to return second solution

Constructor Detail

QuadraticEquation

public QuadraticEquation(double a,
                         double b,
                         double c)
Constructs a new QuadraticEquation problem.

Parameters:
a - - first variable in quadratic equation (ax squared + bx + c)
b - - second variable in quadratic equation
c - - third variable in quadratic equation
Method Detail

getSolution1

public double getSolution1()
Calculates and returns the first solution to the problem.

Returns:

getSolution2

public double getSolution2()
Calculates and returns the second solution to the problem.

Returns:

hasSolutions

boolean hasSolutions()
Determines whether the problem has any real solutions.

Returns: