问题 填空题

请完善程序(程序文件名:Java_1.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。
题目要求:
阅读Java_1.java程序,该程序是分析球队能否升级的程序,每个球队由10名队员组成。程序要求考核队员及格否的标记数,如考核及格输入1,否则输入2。完成程序,运行后完成10个整数(1或2)的输入,如图1所示。


运行结果可能如图2或图3所示。



源程序:
//分析球队升级程序
import javax.swing.JOptionPane;
public class Java_1
public static void main(String args[])
//初始化变量
int passes=0, //考试及格的队员数
failures=0, //考试不及格的队员数
student=1, //学生计数器
result; //分析结果
String input, //输入值
output; //输出字符串
//10个队员,用计数器控制循环
while(student<=10)
input=JOptionPane.sbowlnputDialog("输入队员考核结果(1=及格, 2=不及格)");
result=Integer.parseInt( (1) );
if(result==1)passes=passes+1;
else failures=failures+1;
student=student+1;

//最终分析
output="及格:"+passes+"\n不及格:"+failures;
if(passes>8)output=output+"\n球队升级";
JOptionPane.showMessageDialog(null, (2) , "球队升级分析结果", JOptionPane. INFORMATION_MESSAGE);
System.exit(0);


答案

参考答案:input

解析: 程序通过对话框获取数据,然后根据数据判断,并用对话框显示结果。
前面程序的输入存储在变量input中的是字符串,而后面得判断语句result为整型,所以需要进行转换。

阅读理解

Shelly Nielsen sees students fall asleep in class at least twice a week. “When I see teens asleep in my class, I wonder if I am really that boring”, said Nielsen, a teacher. “I also wonder why they are so tired.” Neilson first tried to wake up sleeping students quietly. If the snoozing (呼噜声) continues, she may call a student’s parents to find out how much sleep the students is getting at night and why.

According to a research, teens need at least nine hours of sleep to function properly during the day. And more than 90 percent of teens say they are sleeping less than that each night.

Forgetting homework, yawning in class, losing concentration --- these are the signs of a sleep-deprived (被剥夺睡眠的)student, said Dr. Carl Lawyer, a specialist. “The big problem is the social demand for homework, video games and friends. Teens don’t understand how important sleep is.”

Rebecca Lucas, another teacher agrees. “Teens are busy,” she said, noting many activities most teens are involved in during the day force them to get home pretty late.” When I see teens sleeping in my class, I feel sad, like they are not sleeping enough,” she said. “I also feel frustrated because I have so much to teach in such a short amount of time and teens sleeping in the class slows me down.”

Not sleeping the needed number of hours can affect your day very much. The effect is on school, work and driving and is very frustrating to teachers when students don’t do their best because of being so tired, Lawyer said.

Al Taylor, a teacher says sleeping is not allowed in his class. “When I see a teen sleeping in my class, I feel bad that they didn’t get enough sleep but they need to correct the issue at home,” Taylor said. “I’ve raised teenage boys myself. Teenagers like to wait to the last minute to do their homework so they often stay up late trying to finish it.”

72. What does Shelly first do when she finds students sleeping in class?

A. She wakes them up with no punishment.

B. She blames herself for giving a boring lesson.

C. She asks them to stand outside.

D. She reports it to their parents.

73. Students always feel tired and sleep in class because they __________.

A. have to stay up late to do their homework.

B. are attracted by many activities.

C. are not interested in the lessons

D. are too busy to have enough sleep

74. From the last paragraph, we can infer that Al Taylor __________.

A. can easily lose his temper

B. was a father of teenage boys

C. has no sympathy for sleeping students

D. finds a good way of giving teens more sleep

75. What is the main idea of the passage?

A. Why sleep is important

B. Why teens are so tired

C. How students get enough sleep

D. How teachers manage sleeping students

填空题