import javax.swing.JOptionPane;
public class Math {
public static void main (String args[]) {
String strA;
String strB;
String strC;
//allows decimals
double dblA, dblB, dblC, dblAnswerOne, dblAnswerTwo, dblM, dblP, dblY, dblX, dblZ;
//This asks what you want to be entered
strA = JOptionPane.showInputDialog("Enter A");
strB = JOptionPane.showInputDialog("Enter B");
strC = JOptionPane.showInputDialog("Enter C");
//This tell java to convert words into number
dblA = Double.parseDouble(strA);
dblB = Double.parseDouble(strB);
dblC = Double.parseDouble(strC);
//Performs Operation
dblM = (dblB * dblB) - (4 * dblA * dblC);
dblP = (- (dblB)) + (Math.sqrt(dblM) );
dblAnswerOne = (dblP / (2 * dblA));
//will have answer Two soon but want to get one down first
JOptionPane.showMessageDialog(null,"X =" + dblAnswerOne);
System.exit(0);
}
}
Here is my compiler :
Any help is appreciatedC:\Documents and Settings\Michael\Desktop\Math.java:28: cannot find symbol
symbol : method sqrt(double)
location: class Math
dblP = (- (dblB)) + (Math.sqrt(dblM) );
^
C:\Documents and Settings\Michael\Desktop\Math.java:28: operator + cannot be applied to double,Math.sqrt
dblP = (- (dblB)) + (Math.sqrt(dblM) );
^
C:\Documents and Settings\Michael\Desktop\Math.java:28: incompatible types
found : <nulltype>
required: double
dblP = (- (dblB)) + (Math.sqrt(dblM) );
^
3 errors
Tool completed with exit code 1