问题 填空题

请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。
[题目要求]
统计一个英文文本字符串包含的英文元音字母的个数,使程序的运行结果如下:
The text contained vowels:88
源程序:
public class Java_3
public static void main(String[] args)
String text = " Beijing, the Capital City, is the political, "
+ "cultural and diplomatic centre of China. It has"
+ "become a modern international cosmopolitan city"
+ " with more than 11 million people. The Capital"
+ " International Airport, 23.5 km from the city centre,"
+ "is China’s largest and most advanced airport. " ;
int vowels =0;
int (1) = text.length();
for(int i = 0;i<textLength; i++)
char ch=Character.toLowerCase( text. (2) );
if(ch==’a’||ch==’e’||ch==’i’||ch==’o’||ch==’u’)
(3) ;

System.out.println( "The text contained vowels:" + vowels +"\n");


答案

参考答案:vowels++

解析: 由最后的输出语句判断出变量vowels表述元音的个数,因此统计出一个元音变量vowels就加1,所以此处应填vowels++。
[程序解析] 本程序统计一个字符串中元音字母的个数,然后输出。由于统计时是不区分大小写的,所以在比较前,先将字符串的每个字母都小写,再进行比较。

翻译题

完成句子

阅读下列各小题,根据每句后的汉语提示,用句末括号内的英语单词完成句子.

1. In order to ____________________by the car, he had to make a sharp turn. (avoid)

为了避免撞上那辆车,他不得不急转弯.

2. Last week, only two people came to look at the house, ____________________ to buy it. (want)

上周只有两个人来看了这个房子,他们都不想买.

3. ____________________, you still need a lot of luck in mountain climbing. (prepare)

无论你准备得多么充分,在爬山时你仍然需要运气.

4. He wondered why people built ugly houses, when they ____________________. (build)

他想知道,人们明明能够造出漂亮的房子,为什么还要建这么难看的房屋呢.

 5. Many students have signed up for __________________ in the sports meeting to be held next week. (race)

许多学生报名参加了下周要举行的运动会中的800米长跑.

6. It is the custom for the Chinese families to get together on New Year's Eve, ____________________ each other. (fun)

除夕夜,家庭成员聚在一起开心地玩是中国的传统.

7. Not only ____________________ the business, he also sponsors charity events. (run)

他不仅善于经营公司,还常赞助慈善活动.

8. If you read his articles carefully, you will find that his writing style ____________________Lu Xun.

    (model)

如果你仔细阅读他的文章,就会发现他的写作风格在模仿鲁迅.

9. Truthfully ____________________, the movie became a hit soon. (adapt)

这部电影如实地改编自一本畅销小说,一经上映就大获成功.

10. -Didn't the guard see him breaking into the bank?

-No, he ____________________ direction. (look)

"保安没有看见他闯入银行吗?"

"没有,他正看着另一个方向."

判断题