我目前停留在編程任務上,這需要我從文本文件中讀取數據然後處理它。該文件是這樣的:使用For循環從文本文件中使用掃描器讀取數據
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
第2行中,然後分配給字段讀,其餘線路爲那些我必須處理。我被告知要使用.useDelimiter("[ ]*(,)[ ]*")
,但到目前爲止還沒有真正能夠很好地使用它。
一旦數據被讀取我用switch語句的字符串轉換成整數,並制定出平均反饋得分如:
優秀= 5
很好= 4
好= 3
截圖:
[你有什麼嘗試?](http://whathaveyoutried.com)向我們展示一些代碼。 – 2013-02-26 17:08:42
哦,請停止格式化。 – 2013-02-26 17:09:35
他們問你使用switch語句將字符串轉換爲整數嗎?哇。 – crush 2013-02-26 17:10:40