You need to sign in to do that
Don't have an account?
Pranav HP 9
Double data type not accepted!!!Help me plz
Hi ,
I have wriiten a code which is to add &sub 2 numbers...When I use data type as int I am able to run the code successfully.However,when I use data type double I am getting an error which says "Method does not exist or incorrect signature: [mathamatics].resultofadd(Decimal, Decimal)".Below is my code:
public with sharing class mathamatics
{
public double resultofadd{get;set;}
public double resultofsub{get;set;}
public mathamatics(){
}
public double resultofadd(double a,double b)
{
double z=a+b;
System.debug(z);
return z;
}
public double resultofsub(double a,double b)
{
double z=a-b;
System.debug(z);
return z;
}
}
In asynchronous window:
mathamatics d=new mathamatics();
d.resultofadd(6.12,4.11);
d.resultofsub(6.022,4.122);
Pls help
I have wriiten a code which is to add &sub 2 numbers...When I use data type as int I am able to run the code successfully.However,when I use data type double I am getting an error which says "Method does not exist or incorrect signature: [mathamatics].resultofadd(Decimal, Decimal)".Below is my code:
public with sharing class mathamatics
{
public double resultofadd{get;set;}
public double resultofsub{get;set;}
public mathamatics(){
}
public double resultofadd(double a,double b)
{
double z=a+b;
System.debug(z);
return z;
}
public double resultofsub(double a,double b)
{
double z=a-b;
System.debug(z);
return z;
}
}
In asynchronous window:
mathamatics d=new mathamatics();
d.resultofadd(6.12,4.11);
d.resultofsub(6.022,4.122);
Pls help
Please use below code:
Thanks
Gaurav
All Answers
Please use below code:
Thanks
Gaurav
could you please try above code and let me know if you still face issues on it.
Hi Pranav,
please select it as best answer then.
Thanks,
Gaurav