assalamo alykom
i made calculator code by myself but it have cerain syntax error i don't know why
plz if anyone know inform me ther is 3 errors mentione at the end
gazakom allah kol 5air
i know there is calculator code on the group but i want to know my errors plz
code as follows:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
private class HelloShereenMIDlet extends MIDlet implements CommandListener
{private Display firstdisplay;
Command command1=new command("Add +",Command.ITEM,1);
Command command2=new command("Sub -",Command.ITEM,1);
Command command3=new command("Mul *",Command.ITEM,1);
Command command4=new command("Div /",Command.ITEM ,1);
Command command5=new command ("Back",Command.ITEM,2);
private TextField a =new TextField(null,"x",2332323,TextField.int);
private TextField b=new Textfield(null,"y",12345633,TextField.int);
private TextField c=new TextField(null,"Z",1234567,TextField.int);
}
public void HelloShereenMIDlet (){
system.out.println("simple calculator");
}
public void startApp(){
Form f=new Form("SIMPLE CALCULATOR");
f.append(a);
f.append(B);
f.append©;
f.addcommand(command1);
f.addcommand(command2);
f.addcommand(command3);
f.addcommand(command4);
f.addcommand(command5);
f.setcommand listner(this);
Display.getDisplay(this).setCurrent(f);
}
protected void destroyApp(boolean unconditional) {}
public void commandAction(Command e, Displayable d)
{ double a1=getnumber(a,"first");
double a2=getnumber(b,"second");
if (e==command1)
c=a1+a2;
else if( e==command2)
c=a1-a2;
else if(e==command3)
c=a1*a2;
else if(e==comand4)
{if (a2==0);
//display.setcurrent(Alert,Displayable);//
alert.setString("Divide by zero.");
else
c=a1/a2;}
else if(e==command5)
c=0;
else
destroyApp(false);
}
Public void pauseApp(){ }
//////////////////////////////////////////////1-what is the function to set the result or its right like this(c value)
2-error in text field definition what is it?
3-error also in the constructor.