My problem is with a Polymorphic method , getSalary (which should be of type double. The problem is that the salary in this case depends on the average mark of a student and thus I felt the need for an If Statement because of the 2 conditions.
However java does not seem to allow 2 returns in the same method and considers the following code as not having a return statement.
@Override
double getSalary()
{
int avg=average(); //average is just a method which returns an average of an array of numbers
if (avg>=50)
return 150.00;
else if (avg<=50)
return 80.00;
}
Thanks in advance for any help and hints in how I can implement this.