应该返回答案,但由于某种原因没有显示。我已经在 for 循环中打印并看到它是正确的答案。
public class Salary
{
public static void main (String[]args)
{
double [] salary = {20000.00};
double riseRate = 1.07;
calculateSalary(salary, riseRate);
}
public static double [] calculateSalary(double [] salary, double riseRate)
{
for (int i=0; i<salary.length; i++)
{
salary [i] = salary [i] * riseRate;
}
return salary;
}
}