hi i am getting an error in my method saying that my method has no return type which is confusing because it has a return type;
public double getPhoneRates() {
final int freeminutes=50;
double totalcharge;
double chargeperminute = 0.10;
double d = 0;
if(b.regularService() == true){
if(b.getMinutes()<=50)
return totalcharge=0;
else
d=b.getMinutes()-freeminutes;
d = d * chargeperminute;
return totalcharge= freeminutes +d;
}
}
Following code should work for you:
In all the cases there should be a return in your method.
And it is usually a better code that returns at only one place from a method.