The problem:
Write a method that takes in an array of salary values and a double
rise rate, to calculate and return the array of salaries after they
are raised. If, for example, the rise rate is 1.07 and one has the
salary of £20000, then after raising the salary is 20000 X 1.07 =
21400.
Please note: it is not a home work but past exam questions from Software & Programming 1, Birkbeck, University of London.
So far I have but I don’t think it’s quite correct, as after compiling, I need to click on inspect.
public class salary
{
public static double [] salary ()
{
double [] salary = {20000};
riseRate = 1.07;
for (int i = 0; i<salary.length; i++)
{
salary [i] = salary[i] * riseRate;
}
return salary;
}
}
All the information you need to construct this simple method is right there.