我目前正忙于一项编程任务,该任务要求我从文本文件中读取数据然后对其进行处理。该文件如下所示:
CS1 2012 Group 1
8
5,5,5,6,5,8,9,5,6,8, good, very good, excellent, good
7,7,8,7,6,7,8,8,9,7,very good, Good, excellent, very good
8,7,6,7,8,7,5,6,8,7 ,GOOD, VERY GOOD, GOOD, AVERAGE
9,9,9,8,9,7,9,8,9,9 ,Excellent, very good, very good, excellent
7,8,8,7,8,7,8,9,6,8 ,very good, good, excellent, excellent
6,5,6,4,5,6,5,6,6,6 ,good, average, good, good
7,8,7,7,6,8,7,8,6,6 ,good, very good, good, very good
5,7,6,7,6,7,6,7,7,7 ,excellent, very good, very good, very good
前两行被读入然后分配给字段,其余行是我必须处理的行。我被告知要使用.useDelimiter("[ ]*(,)[ ]*")
,但到目前为止还没有真正能够很好地使用它。
读入数据后,我必须使用 switch 语句将字符串转换为整数并计算出平均反馈分数,例如:
优秀 = 5
非常好 = 4
好 = 3
截屏 :