问题 填空题

有两个文件Java_2.java和Java_2.html,其中Java_2.java是不完整的,请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。

题目要求:

在Applet中显示0~10的阶乘。

请完善Java_2.java文件,并运行调试(在命令行中使用appletviewer Java_1.html,或者使用集成开发环境),使运行结果如下图所示。

Java_2.java文件源程序:

import java.awt.*;

import java.applet.*;

public class Java_2 extends (1)

TextArea outputArea;

public void init()

setLayout(new BorderLayout());

outputArea=new TextArea();

(2) (outputArea);

//计算0~10的阶乘

for(long i=0; i<=10; i++)outputArea.append(i+"!:"+factorial(i)+"\n");

//用递归定义阶乘方法

public long factorial(long number)

if(number<=1) return 1; //基本情况

else return number *factorial(number-1);

Java_2.html文件源程序:

<html><applet code="Java_2.class" width=275 height=195></applet></html>

2()

答案

参考答案:add

解析:

程序中已经有TextArea类构件,需要添加到内容面板才可以显示。

单项选择题
阅读理解

阅读下面短文,然后回答问题。

     Many people believe that French people are very different from Americans. This is certainly true

where eating habits are concerned (有关的)! According to a report by the World Health Organization

(世卫组织), each year French people eat four times more better than Americans. In addition, they eat

more vegetables, potatoes, grain and fish. Yet, despite(不管) the fact that they eat larger amounts of

these foods, the French take in about the same number of calories each day as Americans.[ French and

American men consume(消耗) about 2,500 calories each day on average. French and American women

take in about 1,600 calories daily.]

     How can this be? If the French are eating more of certain types of foods, shouldn’t this add up to

more calories? And why are so few French people overweight compared to Americans? The answer

is that Americans consume 18 times more refined(精制的) sugar than the French, and drink twice as

much whole milk!

     Although many Americans believe the French end up each meal with gooey ( 胶粘的) desserts, this

just isn’t so. Except for special occasions, dessert in a typical French home consists of fresh fruit or

cheese. Many American families, on the other hand, like to end their meals with a bowl or two of ice

cream or another sweet treat.

1. Name six types of foods that French people eat more of each year than Americans.

      _______________________________________________________________________

2. How many calories does the average Frenchman consume each day?

      _______________________________________________________________________

3. How much whole milk does the average French person drink compared to the average Americans?

      _______________________________________________________________________

4. How much more refined sugar do Americans eat than the French?

      _______________________________________________________________________

5. What do French families usually eat for dessert?

     _______________________________________________________________________