问题 问答题

[说明]
某银行新近开通外汇定期存款业务。为方便用户查询不同存款方式下的日利率、计算本利,特开发了日利率查询及本利计算程序,其运行窗口如下图所示。用户只要在界面上选择相应的存款方式(包括外汇币种、存期等),便可单击按钮一查询存款日利率。若输入一定数量的本金。程序还会根据所选择的存期计算并输出本利和。


在开发过程中,选择币种和存期的组合框(ComboBox)名分别为Combo1和Combo2,单旋钮 (CommandButton)“个人单位”和“金融机构”分别名为Option1和Option2,用于输入本金的文本框 (TextBox)名为Price,“输出日利率”和“计算本利和”按钮(CommandButton)分别名为Command1和 Command2。且已知,第i类币种、第j类存期之下,个人单位与金融机构的存款日利率分别存放于数组元素interestRate(i,j,0)和interestRate(i,j,1)中,其中i,j从0开始计数。
[Visual Basic代码]
Dim interestBate(50,10,2) As Single ’通用声明
Private Sub Form_Load()
…… ’为数组interestRate赋初值
End Sub
’根据所选择的币种、存期等信息确定日利率
Function getInterestRate()
Dim strCurrency, strTime As String, i, j, k, intDays As Integer
strCurrency = Combo1.Text
strTime = Combo2.Text
For i = 0 To Combol. ListCount - 1
If Combol.List(i) = strCurrency Then (1)
Next
For j = 0 To Combo2.ListCount - 1
IfCombo2.List(j) = strTime Then (1)
Next
If (2) =True Then
k=0
Else: k=1
End If
(3) = interestRate(i, j, k)
End Function
’输出日利率
Private Sub Commund1_Click()
MsgBox "日利率为" & getInterestRate()
End Sub
’输出本利和
Private Sub Command2_Click()
Dim strTime As String, intDays As Integer, sngCorpus, sngResult As Single
strTime = Combo2. Text
sngCorpus = CSng(Text1.Text)
(4) ’计算存款天数(以每月30天计)
Case "一个月" :intDays = 30
Case "三个月" :intDays = 90
Case "六个月" :intDays = 120
End Select
’计算并输出本利和
sngResult = sngCorpus + (5)
MsgBox "本利之和为:" & sngResult
End Sub

答案

参考答案:(1) Exit For (2) Option1.Value (3) getInterestRate (4) Select Case strTime
(5) sngCorpus * intDays * getInterestRate()

解析: (1)此处需要查询interestRate中数组元素的下标,即组合框中所选择项的编号。因此循环遍历组合框的各项,当某项与所选项匹配时,应即刻退出循环;
(2)由于数组元素interestRate(i,j,0)对应于个人单位,即单选钮Option1被选中,其Value属性为真;
(3)函数最后需要返回日利率的值,其形式为:函数名=表达式;
(4)“Select Case表达式……End Case”是VB提供的多分支选择结构,这里需要根据用户选择的存期strTime来确定天数;
(5)此处应填入计算利息的表达式。

阅读理解

阅读理解

     Nick Campbell sat at the side of the road and wondered what to do next.He looked at the secondhand Harley Davidson he'd bought from a backstreet garage back home in Miami at the beginning of his trip six weeks before.

     For years he had dreamt of crossing the United States from east to west by motorbike and he'd finally decided that it was now or never.He'd given up his job,sold his car and set off for the journey of his

dreams.He'd been lucky,or so he thought,to find this old Harley Davidson and had bought it for a very

reasonable price-it had cost him just $600.But five kilometres from Atlanta,he had run out of luck.The

motorbike had broken down.

     He pushed the bike into town and found a garage.The young mechanic told him to leave the bike

overnight and come back the next day.The following morning,to his surprise,the man asked if the bike was for sale.'Certainly not,' he replied,paid his bill and hit the road.

     When he got to Kansas the old machine ran out of steam again.This time Nick thought about selling it

and buying something more reliable,but decided to carry on.When the bike was going well,he loved it.

     However,in Denver,Colorado the bike broke down again so he decided to take it to a garage and offer it for sale.The mechanic told him to come back in the morning.

     The next day,to his amazement,the man offered him $2,000.Realising the man must be soft in the head,but clearly not short of money,Nick asked for $3,000.The man agreed and they signed the papers.Then

the mechanic started laughing.In fact it was several minutes before he could speak and when he could he

said,"That's the worst deal you'll ever make,boy."

     He removed the seat.On the underside was the inscription (铭文):

     'To Elvis,love James Dean.'

1. Harley Davidson here refers to a________.

A. car  

B. truck  

C. garage  

D. motorbike

2. Which of the following did Nick value most?

A. Harley Davidson.  

B. His job.

C. His dream to travel.  

D. His car.

3. Nick was unwilling to sell his Harley Davidson because he thought it was________.

A. lovely  

B. valuable  

C. reliable  

D. old

4. The underlined word soft in the 6th paragraph is closest in meaning to________.

A. clever  

B. crazy  

C. honest    

D. kind

5. At the end of the story,Nick must have felt very________.

A. sorry

B. delighted  

C. excited  

D. moved

单项选择题