java ,句子中的单词按顺序输出老师出了一个别扭的题.一共四个英文句子1 The bus was crowded and no vacant seat was to be found.6 5 2 9 12 1 4 11 10 7 3 82 I will never come to such an unpleasant place again.2 8 6 10 9 1 5 3 7

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 06:07:02
java ,句子中的单词按顺序输出老师出了一个别扭的题.一共四个英文句子1 The bus was crowded and no vacant seat was to be found.6 5 2 9 12 1 4 11 10 7 3 82 I will never come to such an unpleasant place again.2 8 6 10 9 1 5 3 7

java ,句子中的单词按顺序输出老师出了一个别扭的题.一共四个英文句子1 The bus was crowded and no vacant seat was to be found.6 5 2 9 12 1 4 11 10 7 3 82 I will never come to such an unpleasant place again.2 8 6 10 9 1 5 3 7
java ,句子中的单词按顺序输出
老师出了一个别扭的题.一共四个英文句子
1 The bus was crowded and no vacant seat was to be found.
6 5 2 9 12 1 4 11 10 7 3 8
2 I will never come to such an unpleasant place again.
2 8 6 10 9 1 5 3 7 4
3 My family shall not want for anything as long as I live.
7 2 12 10 3 8 4 9 6 11 5 1
4 I have just been to the hospital to inquire after Mr.A.
11 4 2 9 7 10 1 6 3 5 8
首先,在屏幕上输出这四句话,然后问用户选择哪句话,然后 按句子下面的数字,一次输出对应位置的单词.如 输出3 ,则显示
anything family live as shall as not long for I want My

java ,句子中的单词按顺序输出老师出了一个别扭的题.一共四个英文句子1 The bus was crowded and no vacant seat was to be found.6 5 2 9 12 1 4 11 10 7 3 82 I will never come to such an unpleasant place again.2 8 6 10 9 1 5 3 7
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Test test1 = new Test("The bus was crowded and no vacant seat was to be found.",6,5,2,9,12,1,4,11,10,7,3,8);
Test test2 = new Test("I will never come to such an unpleasant place again.",2,8,6,10,9,1,5,3,7,4);
Test test3 = new Test("My family shall not want for anything as long as I live.",7,2,12,10,3,8,4,9,6,11,5,1);
Test test4 = new Test("I have just been to the hospital to inquire after Mr.A.",11,4,2,9,7,10,1,6,3,5,8);
Test[] tests = {test1,test2,test3,test4};
for (int i = 0; i < tests.length; i++) {
System.out.println(i+1+" : "+tests[i].getSentence());
}
System.out.println("请选择你要输出的话:");
int i = input.nextInt();
System.out.println(tests[i-1]);
}
private String sentence;
private int[] indexs;
public int[] getIndexs() {
return indexs;
}
public void setIndexs(int[] indexs) {
this.indexs = indexs;
}
public Test() { }
public Test(String sentence, int...indexs) {
this.sentence = sentence;
this.indexs = indexs;
}
public String getSentence() {
return sentence;
}
public void setSentence(String sentence) {
this.sentence = sentence;
}
public String toString() {
String[] words = sentence.split(" ");
StringBuffer newSentence = new StringBuffer();
for (int i = 0; i < indexs.length; i++) {
newSentence.append(words[indexs[i]-1]+" ");
}
return newSentence.toString();
}
}

java ,句子中的单词按顺序输出老师出了一个别扭的题.一共四个英文句子1 The bus was crowded and no vacant seat was to be found.6 5 2 9 12 1 4 11 10 7 3 82 I will never come to such an unpleasant place again.2 8 6 10 9 1 5 3 7 java 输入一句英文句子,翻转句子中单词的顺序,单词内字符的顺序也要改变,句子中单词以空格符隔开.例如如果输入时Hello,please fix me!,输出就应该是!me fix please,Hello java英文字母排序问题...编写一个程序,当输入不超过60个字符组成的英文文字时,计算机将这个句子 中的字母按英文字典字母顺序重新排列,排列后的单词的长度要与原始句子中的长度 相同.例 用java 编写一个程序,接受用户输入的一段英文文字,统计出其中的字符个数、单词个数和句子的个数.设句子以“.”“!”“?”结束,单词之间利用空格分隔 Java编写程序,产生10个随机数,然后按产生顺序相反的次序输出这些随机数. java编程,输出3个数中的最大值和最小值 一句话,由英文字母,数字及常用标点符号组成.统计句子中各单词出现的次数,并按单词在句子中第一次出现的的顺序输出.输出包括若干行,每一行是一个单词,空格再跟着该单词在句子中出现的 JAVA题,使用java.lang.Math类,生成50个0到99之间的不重复的随机整数,并按降序的顺序输出这些整数使用java.lang.Math类,生成50个0到99之间的不重复的随机整数,并按降序的顺序输出这些整数.提示:Math 用JAVA编写一个程序能统计每个长度的单词的数量!根据给定的一行英文字母,将其中的单词(按空格区分)一句单词的长度进行统计,即统计不同长度的单词出现的次数,并按照指定的格式输出. JAVA统计一篇文章中所有单词出现的次数,并按字典序将单词及频数输出到文件中 设计一个java程序,从键盘输入三个整数,按照从小到大的顺序输出 如何使用java将Java is an object oriented programming language输出,并且计算出单词的平均长度 提取英文句子中的单词并排序输出 c语言写一个分词函数,提取出一个英文句子中的所有单词,保存到一个单词数组中.另写一个排序函数对字符串数组进行升序排序.在主函数中调用分词函数得 英语句子中的单词是怎么按照上面顺序排的啊 提取出一个英文句子中的所有单词,保存到一个单词数组中. 提取出一个英文句子中的所有单词,保存到一个单词数组中. 字典排序 c++给出n个单词,每个单词大长度不超过20,请按字典顺序输出.输入:5iadcccfac输出:abcccfaci好的话有追分 c++比较5个单词的各个字母,按照该单词在英文字典出现中的先后顺序,输出这5个英文单词