Lab 3: Quadratic Acrobatics

Due by the end of class

Your mission is similar to the lab for last week. You must implement a simple program that asks the user for three values, a, b, and c, which you should store as double values. Using these numbers, you compute the value of the the two solutions to the quadratic equation, assuming that the equation is of the form:

Quadratic Equation

To compute the two solutions, or roots, of the equation, use the following well known formula:

Quadratic Formula

Output the two solutions, nicely formatted.

Don't be afraid to ask for help.

Note: Images stolen from Wikipedia

Specification

Create a project called Lab3. Add a class called Quadratic. Complete the description of the program given above so that your output looks as close to the following sample output as possible. In this sample, the user entered 2.0, -5.0, and 2.0, respectively. User input is shown in green.

Welcome to the quadratic equation solver!
For an equation of the form ax^2 + bx + c,
Enter a: 2.0
Enter b: -5.0
Enter c: 2.0
The answers are x = 2.0 and x = 0.5

The quadratic formula is given above. You will have to compute the + and - parts separately, since Java does not contain a ± operator.

You will need to use the Math.sqrt() method.

Turn In

Turn in your code by uploading Quadratic.java from the Lab3\src folder wherever you created your project to Blackboard. Do not upload the entire project. I only want the Quadratic.java file.

All work must be done individually. Never look at someone else's code. Please refer to the course policies if you have any questions about academic integrity. If you have trouble with the assignment, I am always available for assistance.