outputGrade を String として定義したため、型を String として返す方法がわかりませんが、単一の数値を計算しようとしています。例- mark=79 の場合、outputGrade 文字列 = "9"
private static String printResult (int numAssignments, double studentMark)
{
int outputGradeSingle;
String outputGrade;
switch (numAssignments)
{
case 0: outputGrade="DNA-";
break;
case 1: case 2: case 3: case 4: outputGrade="DNC-";
break;
case 5: if (studentMark<50.0)
{
outputGrade="F-";
}
else
{
outputGradeSingle=(studentMark/10);
outputGrade= String.valueOf(outputGradeSingle);
}
break;
default: outputGrade="Not a valid amount of assignments, range is between 0 and 5";
break;
}
return outputGrade;
}
}