Help with Quadratic forumla equation in java please.

I am in an introductory class of Java programming and our first assignment is to create a program that can compute -b +- √b^2 - 4ac / 2a. This is my first time doing anything with java and I'm rather lost on the if/else statement and doing the square roots. Any help with this would be greatly apperciated.

So far this is all I have

import java.util.Scanner;

import javax.swing.JOptionPane;

public class homework1

{

public static void main(String[] args)

{

//Display message

double aceof = (double)

double bceof = (double)

double cceof = (double)

System.out.print("Enter A")

double aceof = input.nextDouble();

System.out.print("Enter B")

double bceof = input.nextDouble();

System.out.print("Enter C")

double cceof = input.nextDouble();

if (aceof == 0)

Re: Help with Quadratic forumla equation in java please.

Ok, well what specifically about the if/else statement is confusing? What are you needing to do?

In JAVA, we have a very rich API. One notable class is the Math Class(Math (Java Platform SE 6)).

In the Math Class, there is the following method:

Quote:

sqrt

public static double sqrt(double a)

Returns the correctly rounded positive square root of a double value. Special cases:

* If the argument is NaN or less than zero, then the result is NaN.

* If the argument is positive infinity, then the result is positive infinity.

* If the argument is positive zero or negative zero, then the result is the same as the argument.

Otherwise, the result is the double value closest to the true mathematical square root of the argument value.

Parameters:

a - a value.

Returns:

the positive square root of a. If the argument is NaN or less than zero, the result is NaN.

Does that make sense?