系統:麻煩會議規範格式錯誤
.out.println("For test 1,");
for (int i = 0; i < testOne.length; i++)
{
System.out.print("Enter score " + (i + 1) + ": ");
testOne[i] = keyboard.nextInt();
}
System.out.println();
System.out.println("For test 2,");
for (int i = 0; i < testTwo.length; i++)
{
System.out.print("Enter score " + (i + 1) + ": ");
testTwo[i] = keyboard.nextInt();
}
for (int i = 0; i < average.length; i++)
{
average[i] = ((testOne[i] + testTwo[i])/2.0D);
if (Double.doubleToLongBits(average[i]) > Double.doubleToLongBits(90.0D)) {
grade[i] = 'A';
} else if (Double.doubleToLongBits(average[i]) > Double.doubleToLongBits(80.0D)) {
grade[i] = 'B';
} else if (Double.doubleToLongBits(average[i]) > Double.doubleToLongBits(70.0D)) {
grade[i] = 'C';
} else {
grade[i] = 'F';
}
}
System.out.println();
System.out.println("Test 1\tTest 2\tAverage\tGrade");
System.out.println("------\t------\t-------\t-----");
for (int i = 0; i < testOne.length; i++) {
System.out.println(testFormat.format(testOne[i]) + "\t" + testFormat.format(testTwo[i]) + "\t" + averageFormat.format(average[i]) + "\t" + grade[i]);
}
}
}
The output looks like this:
Test 1 Test 2 Average Grade
------ ------ ------- -----
089 098 093.5 A
097 085 091.0 A
094 096 095.0 A
078 073 075.5 C
What I need:
Test 1 Test 2 Average Grade
------ ------ ------- -----
089 098 093.5 A
097 085 091.0 A
094 096 095.0 A
078 073 075.5 C
我想知道是,如果有人可以幫助我的,阻止我未能完成該程序的格式問題?我需要將這些數據歸入正確的列和類別,因爲這是規範要求的。對簡單格式問題的任何幫助都會很好,深受讚賞。