
Hi, i had developed assignment on sun sdk and its running fine on emulator but not showing results in two text fields on my mobile phone i.e.nokia -n79.please Help
public class MoneyL extends MIDlet
implements CommandListener
{
private static final Command CMD_EXIT = new Command("Exit", 7, 1);
private boolean firstTime = true;
private Date today=new Date();;
private Date td1;
public long l;
public long l1;
public long l2;
public long temp1;
public long temp2;
public Integer temp3,ref1,y;
public float flt;
float flt1;
int reso;
public double amount;
public double intrate,interest,amt;
public double ref;
public double dd2,yy2,dm2,dd1,yy1,dm1,d1,d2,tempo1,result;
public double total = 0.0D;
String str,mm1,mm2;
public char[] temp = new char[10];
public char[] temp11 = new char[10];
public char[] temp12 = new char[10];
public char[] temp13 = new char[10];
public char[] temp14 = new char[10];
public char[] temp15 = new char[10];
public char test;
String str1,str5,str6,str7,str8,str9,str10,str11,str12,str13,str14,str15,str16,str17,str18,str19,str20,str21,str22,str23;
Calendar rightNow = Calendar.getInstance();
private final Command exitCmd = new Command("Exit", 7, 1);
private final Command calcCmd = new Command("Calc", 1, 2);
private final DateField dt1 = new DateField("Start Date", 1);
private final TextField t1 = new TextField("Amount", "", 7, 2);
private final TextField t2 = new TextField("Interest Rate", "", 4, 5);
private final DateField dt2 = new DateField("End Date", 1);
private final TextField tr1 = new TextField("Interest", "", 100, 131072);
private final TextField tr2 = new TextField("Total", "", 100, 131072);
private final Alert alert = new Alert("Error", "", null, AlertType.ERROR);
private Ticker t;
private static final String TICKER_TEXT = "Tirupati Money Lending Application Developed By Lalit N. Jadiya...";
private Form mainForm = new Form("Tirupati Jewellers");
protected void startApp()
{
if (this.firstTime)
{
this.mainForm.append(this.dt1);
this.today = new Date(System.currentTimeMillis());
this.dt2.setDate(this.today);
this.mainForm.append(this.t1);
this.mainForm.append(this.t2);
this.mainForm.append(this.tr1);
this.mainForm.append(this.tr2);
this.mainForm.addCommand(this.calcCmd);
this.mainForm.addCommand(this.exitCmd);
this.t = new Ticker("Tirupati Money Lending Application Developed By Lalit N. Jadiya...");
this.mainForm.setTicker(this.t);
this.alert.addCommand(new Command("Back", 1, 1));
this.mainForm.setCommandListener(this);
this.firstTime = false;
}
Display.getDisplay(this).setCurrent(this.mainForm);
}
protected void destroyApp(boolean paramBoolean)
{
}
protected void pauseApp()
{
}
public void commandAction(Command paramCommand, Displayable paramDisplayable)
{
if (paramCommand == this.exitCmd)
{
destroyApp(false);
notifyDestroyed();
return;
}
double d1 = 0.0D;
try
{
str5=today.toString();
str5.getChars(8,10,temp,0);
str6=new String(temp);
dd2=Double.parseDouble(str6);
str5=today.toString();
str5.getChars(24,28,temp15,0);
str7=new String(temp15);
yy2=Double.parseDouble(str7);
str5=today.toString();
str5.getChars(4,7,temp11,0);
str9=new String(temp11);
str9=str9.substring(0,3);
if(str9.equals("Jan"))
{mm2="1";}
if(str9.equals("Feb"))
{mm2="2";}
if(str9.equals("Mar"))
{mm2="3";}
if(str9.equals("Apr"))
{mm2="4";}
if(str9.equals("May"))
{mm2="5";}
if(str9.equals("Jun"))
{mm2="6";}
if(str9.equals("Jul"))
{mm2="7";}
if(str9.equals("Aug"))
{mm2="8";}
if(str9.equals("Sep"))
{mm2="9";}
if(str9.equals("Oct"))
{mm2="10";}
if(str9.equals("Nov"))
{mm2="11";}
if(str9.equals("Dec"))
{mm2="12";}
dm2=Double.parseDouble(mm2);
str5="";
str6="";
str7="";
str10="";
this.td1 = this.dt1.getDate();
str5=td1.toString();
str5.getChars(8,10,temp13,0);
str6=new String(temp13);
dd1=Double.parseDouble(str6);
str5=td1.toString();
str5.getChars(24,28,temp14,0);
str7=new String(temp14);
yy1=Double.parseDouble(str7);
str5=td1.toString();
str5.getChars(4,7,temp12,0);
str10=new String(temp12);
str10=str10.substring(0,3);
if(str10.equals("Jan"))
{mm1="1";}
if(str10.equals("Feb"))
{mm1="2";}
if(str10.equals("Mar"))
{mm1="3";}
if(str10.equals("Apr"))
{mm1="4";}
if(str10.equals("May"))
{mm1="5";}
if(str10.equals("Jun"))
{mm1="6";}
if(str10.equals("Jul"))
{mm1="7";}
if(str10.equals("Aug"))
{mm1="8";}
if(str10.equals("Sep"))
{mm1="9";}
if(str10.equals("Oct"))
{mm1="10";}
if(str10.equals("Nov"))
{mm1="11";}
if(str10.equals("Dec"))
{mm1="12";}
dm1=Double.parseDouble(mm1);
intrate=0.0;
amount=0.0;
interest=0.0;
amt=0.0;
ref=0.0;
d2=0.0;d1=0.0;result=0.0;
tempo1=0.0;
str8="";
this.intrate = getNumber(this.t2, "Interest Rate");
this.amount = getNumber(this.t1, "Amount");
interest=intrate;
amt=amount;
interest=interest/30/100;
ref=yy2;
d2=(dm2-1)*30;
d2=(d2+dd2+(yy2-ref)*360);
str8=Double.toString(d2);
d1=(dm1-1)*30;
d1=(d1+dd1+(yy1-ref)*360);
tempo1=(d2-d1);
if(tempo1<30)
{ tempo1=30;}
result=interest*amt*tempo1;
reso=(int)result;
str8=Integer.toString(reso);
result=result+amt;
reso=(int)result;
str10=Integer.toString(reso);
str12=Double.toString(yy2);
tr1.setString(str8);
tr2.setString(str10);
}
catch (NumberFormatException localNumberFormatException)
{
return;
}
catch (ArithmeticException localArithmeticException)
{
this.alert.setString("Divide by zero.");
Display.getDisplay(this).setCurrent(this.alert);
return;
}
}
private double getNumber(TextField paramTextField, String paramString)
throws NumberFormatException
{
String str2 = paramTextField.getString();
if (str2.length() == 0)
{
this.alert.setString(" Please Enter:" + paramString);
Display.getDisplay(this).setCurrent(this.alert);
throw new NumberFormatException();
}
double d;
try
{
d = Double.parseDouble(str2);
}
catch (NumberFormatException localNumberFormatException)
{
this.alert.setString(paramString + " argument is out of range.");
Display.getDisplay(this).setCurrent(this.alert);
throw localNumberFormatException;
}
return d;
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.