问题 填空题

阅读下列说明和C++代码,将应填入 (n) 处的字句写在对应栏内。

[说明]

某软件公司现欲开发一款飞机飞行模拟系统,该系统主要模拟不同种类飞机的飞行特征与起飞特征。需要模拟的飞机种类及其特征如表18-6所示。

为支持将来模拟更多种类的飞机,采用策略设计模式(Strategy)设计的类图如图18-21所示。

在图18-21中,AirCraft为抽象类,描述了抽象的飞机,而类Helicopter、AirPlane、Fighter和Harrier分别描述具体的飞机种类,方法fly()和takeOff()分别表示不同飞机都具有飞行特征和起飞特征;类FlyBehavior与TakeOffBehavior为抽象类,分别用于表示抽象的飞行行为与起飞行为;类SubSonicFly与SuperSonicFly分别描述亚音速飞行和超音速飞行的行为;类VerticalTakeOff与LongDistanceTakeOff分别描述垂直起飞与长距离起飞的行为。

[C++代码]

#include<iostream>

using namespace std;

class FlyBehavior

public:virtual void fly()=0;

class SubSonicFly:public FlyBehavior

public:void fly()cout<<"亚音速飞行!"<<end1;

Class SuperSonicFly:public FlyBehavior

public:void fly()cout<<"超音速飞行!"<<end1;

class TakeOffBehavior

public:virtual void takeOff()=0;

class VerticalTakeoff:public TakeOffBehavior

public:void takeOff()cout<<"垂直起飞!"<<end1;

class LongDistanceTakeoff:public TakeOffBehavior

public:void takeOff()cout<<"长距离起飞!"<<end1;

class AirCraft

protected:

(1)

(2)

public:

void fly() (3)

void takeOff() (4) ;;

class Helicopter:public AirCraft

public:

Helicopter()

flyBehavior=new (5)

takeoffBehavior=Flew (6)

(7)

if(!flyBehavior)delete flyBehavior;

if(!takeOffBehavior)delete takeOffBehavior;

//其他代码省略

(7)处填()。

答案

参考答案:~Helicopter()

阅读理解

Very few people enjoy exams. I don’t, either. And although I tell myself not to worry about them, I always do! So I’m not surprised that my students worry about them, too, even though they usually don’t need to. Because they are afraid of failing. However, since it is hard not to worry at all, we all must try not to worry too much. Why? Because worrying makes exams worse! How to do this?

Ask the teacher about how to revise and about exam skills—how to work when you are in the exam. Good students don’t wait until the week before an exam. They study all through the year. It is not possible to learn everything at the last minute. So don’t leave it till then.

If you start planning and working for each exam early and you make sure that you understand what you’re studying, then, when it is over, you’ll be able to say, “What a good exam that was!”

Take a short rest during your time of work and revision. If your mind is tired, it won’t remember well. Work at the time when you know you’ll work at your best.

If you’re studying in the evening, don’t go straight to bed afterwards. Your mind will still be “going round and round”—thinking too much. Do something else, maybe walk or get exercise. Choose something that will relax you, and make you think of other things.

If you feel bad, talk to someone about your worries. But don’t be too relaxed! Some stress over exams makes you work hard for them.

小题1:How does the writer feel about exams?

A.Excited.

B.Bored.

C.Worried.

D.Surprised.小题2:Why are the students afraid of exams?

A.Because they are afraid of failing.

B.Because they want to get full marks.

C.Because exams are usually hard.

D.Because their teachers will be angry at their bad grades.小题3:Which is NOT mentioned in the passage?

A.Good students don’t wait until the week before an exam.

B.Start planning and working for each exam early.

C.If you don’t know how to work for an exam, ask the teacher about it.

D.You should sleep well before the exam.小题4:According to the passage, if you feel bad, you’d better _____.

A.take a short rest

B.tell someone about your worries

C.walk or get exercise

D.keep busy working and forget your worries

单项选择题