java无忧网

标题: 英文作业:输入一句话对英文单词进行处理 [打印本页]

作者: java无忧网    时间: 2018-10-15 19:55
标题: 英文作业:输入一句话对英文单词进行处理
Assignment #5
Problem Description
Design and implement a java application that reads a sentence (one line of text) from the user, it then displays a menu for different tasks.
The following is a screen sample of the program:
Please enter a sentence:
A digital computer stores information as numbers (1234).
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement.
6. To terminate the program.
1
There are 8 words in “A digital computer stores information as numbers (1234).”
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement.
6. To terminate the program.
2
There are:
        4 a’s
        3 e’s
        4 i’s
        4 o’s
        2 u’s
in “A digital computer stores information as numbers (1234).”
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement
6. To terminate the program.
3
The longest word is:  information
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement
6. To terminate the program.
4
The word with the most vowels is: information
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement
6. To terminate the program.
5
Please enter a new statement:
   Java is an Object-Oriented computer programming language.
Please enter:
1. To display the number of words in the sentence.
2. To display the number of vowel characters in the sentence.
3. To display the word with the most number of characters.
4. To display the word with the most vowels.
5. To enter a new statement
6. To terminate the program.
6
Program terminates
Notes:
· Use the Scanner nextLine method to read the sentence from the user.
· Create a method for each task.
· In your main method read the sentence from the user, then display the menu, and use a switch statement to call appropriate method for each task.
· The program should be repeated until the user enters 6 to terminate.
Marking Scheme
[2 marks] Presentation/Style: Organization, readability, descriptive
                           identifier, indentation, bracket placement.
[16 marks] Correctness: Program works without bugs.
[2 marks] Documentation: Internal
此源码经过详细测试 保证能运行!!!

运行视频:

https://pan.baidu.com/s/14vTNjxwSlIvgwG1h43Ttjw

下载地址:
**** 本内容需购买 ****






欢迎光临 java无忧网 (http://www.javawyw.com/) Powered by Discuz! X3.2