这是评估工作,所以请不要直接回答。
我的程序应该计算用户等级:“通过”、“失败”或“通过补偿”。但是,它不会返回答案。我无法弄清楚为什么 - 任何人都可以帮忙吗?
公共类 MarkCalculator { 静态 int[] 标记 = new int[12];
//public static Scanner keyboard = new Scanner(System.in);
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int weighting;
int coursework;
int exammark;
System.out.println("Please enter course work weighting");
marks[0]= kb.nextInt();
System.out.println("Please enter course work mark");
marks[1]= kb.nextInt();
System.out.println("Please enter exam mark");
marks[2]= kb.nextInt();
MarkCalculator mc = new MarkCalculator();
mc.computeMarks(marks);
}
public String[] computeMarks(int[] marks) {
final int[] WEIGHTING = {55,66,55,44,33,44};
String[] results = new String[WEIGHTING.length];
for (int i = 0; i < marks.length / 2; i++) {
int exam = marks[i];
int cw = marks[i];
int weight = WEIGHTING[i];
int formula = ((cw + weight) + (exam * (100 - weight)) / 100);
if (formula >= 40){
results[i]="PASS";
} else if ((formula < 39) && (formula > 35)){
results[i]="COMPENSATION PASS";
}else{
results[i]="FAIL";
}
}
return results;
}
}