java 作业求解答
下面是题目要求我不明白的是如何估计file中单词的数量然后创建一个array的数组例如Sting[]words=newString[ESTIMATED_SIZE]然后把单...
下面是题目要求 我不明白的是如何估计file中单词的数量 然后创建一个array的数组例如Sting[] words = new String [ESTIMATED_SIZE] 然后把单词存在数组中 存了之后此时如果String[1]的话是一个字母呢还是一个单词呢 还有有可能存为单词吗 求大神~
You have been asked to read a text file word by word, and then use quicksort to sort the words in alphabetical order, and save them in sorted order in another file with following specifications:
Prompt user to input for file names.
Estimate the number of the words in the file, and then create an array of String such as Sting[] words = new String [ESTIMATED_SIZE] and store words in the array.
Change all word to lower case.
If words have a punctuation symbol in the beginning or at the end of the words, then remove the punctuation marks from the word, and keep the word.
You need to remove the following punctuation marks from each word; [ '.' (dot), ',' (comma), ';' (semi-colon), ':' (colon), '?' (question mark), '!' (exclamation), ' " ' (double quotation), ' \' ' (single quotation) , ')' (opening parentheses) , and '(' (closing parenthesis )].
If words still have any symbol except '-' (hyphen), then ignore the words.
Get rid of the the hyphen(s) that are not inside a word.
Get rid of the words that contain digits.
Get rid of spaces from both side of the words.
Save the file in unique order. If there are many occurrences of the same word, then save only one of isntance of the word. 展开
You have been asked to read a text file word by word, and then use quicksort to sort the words in alphabetical order, and save them in sorted order in another file with following specifications:
Prompt user to input for file names.
Estimate the number of the words in the file, and then create an array of String such as Sting[] words = new String [ESTIMATED_SIZE] and store words in the array.
Change all word to lower case.
If words have a punctuation symbol in the beginning or at the end of the words, then remove the punctuation marks from the word, and keep the word.
You need to remove the following punctuation marks from each word; [ '.' (dot), ',' (comma), ';' (semi-colon), ':' (colon), '?' (question mark), '!' (exclamation), ' " ' (double quotation), ' \' ' (single quotation) , ')' (opening parentheses) , and '(' (closing parenthesis )].
If words still have any symbol except '-' (hyphen), then ignore the words.
Get rid of the the hyphen(s) that are not inside a word.
Get rid of the words that contain digits.
Get rid of spaces from both side of the words.
Save the file in unique order. If there are many occurrences of the same word, then save only one of isntance of the word. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询