/*
* 题目描述
给定一个由5个信息段组成的英文文本,段之间用分号隔开,要求编写一段程序判断第3段是否包含"China"或"Chinese"单词。
输入描述
文本
输出描述
包含xxx
包含xxxx
输入样例
Hong Kong - Wikipedia;the free encyclopedia
Hong Kong (Chinese); is one of two special; administrative regions (SARs) of
the People's Republic of China (PRC);the other; being Macau
输出样例 包含China
*/
package exam2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author Administrator
*/
public class Test2 {
String text=null;
boolean isHas=false;
public boolean isIsHas() {
return isHas;
}
public void setIsHas(String text,String s) {
boolean isHas=false;
String str[]=text.split(";");
if(str[2].indexOf(s)>=0){
isHas=true;
}
this.isHas = isHas;
}
public String getText() {
return text;
}
public void setTest() throws IOException {
String text=null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
text=br.readLine();
this.text = text;
}
public static void main(String[] args) throws IOException {
Test2 test = new Test2();
test.setTest();
test.setIsHas(test.getText(), "China");
if(test.isIsHas()){
System.out.println("包含China");
}
test.setIsHas(test.getText(), "Chinese");
if(test.isIsHas()){
System.out.println("包含Chinese");
}
}
}