java在数组中计算工资并返回答案
问题是:
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.
请注意:这不是一个家庭作业,而是来自软件与技术部的过去考试题;编程1,BikBek,伦敦大学。
到目前为止,我有,但我不认为这是非常正确的,因为编译后,我需要单击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;
}
}
# 1 楼答案
构建这个简单方法所需的所有信息都在这里