Hi,
I'm very new to j2me and* java.
I tried to create a program that solves a quadratic equation.
Here's the source code that i tried:


Java Code:
import javax.microedition.lcdui.*;
import java.lang.*;
import javax.microedition.midlet.MIDlet;

public class TextBoxCapture extends MIDlet implements CommandListener {
* private Display display;

* private Form form = new Form("aX^2+bX+c");

* private Command submit = new Command("Submit", Command.SCREEN, 1);

* private Command exit = new Command("Exit", Command.EXIT, 1);

* private TextField textfield = new TextField("a:", "", 30, TextField.PHONENUMBER);
* private TextField textfield1 = new TextField("b:", "", 30, TextField.PHONENUMBER);
* private TextField textfield2 = new TextField("c:", "", 30, TextField.PHONENUMBER);
* private TextField textfield3 = new TextField("x1:", "", 30, TextField.PHONENUMBER);

* public TextBoxCapture() {
* * display = Display.getDisplay(this);
* * form.addCommand(exit);
* * form.addCommand(submit);
* * form.append(textfield);
* * form.append(textfield1);
* * form.append(textfield2);
* * form.append(textfield3);
* * form.setCommandListener(this);
* }

* public void startApp() {
* * display.setCurrent(form);
* }

* public void pauseApp() {
* }

* public void destroyApp(boolean unconditional) {
* }

* public void commandAction(Command command, Displayable displayable) {
* * if (command == submit) {
* * * double a = Double.parseDouble( textfield.getString());
* * * double b = Double.parseDouble( textfield1.getString());
* * * double c = Double.parseDouble( textfield2.getString());
* * * double b2 = b*b+4*a*c;
* * *
* * * *double x1;
* * * *x1 = b*-1+Math.sqrt(b2);
* * * *String x1Str = Double.toString(x1);
* * * *textfield3.setString(x1Str);
* * * form.removeCommand(submit);


* * } else if (command == exit) {
* * * destroyApp(false);
* * * notifyDestroyed();
* * }
* }



}
I've created 4 TextFields and 2 commands.
Now i dont know how to do the math part ((-b+sqrt(b^2+4ac))/2) in code,
and also, the string isnwt printed in the textfield (textfield3.setString(x1Str)) .

Sorry about my english, please help.
Vladi.