VF课程设计
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
数据库原理与应用课程设计报告
实训任务一:
1、在编辑框中输出101~500之间的所有奇数,并将这些奇数之和显示在文本框中。
2、求出所有小于或等于100的自然数对并显示在列表框中。(自然数对是指两个自然数的和与差都是平方数)
3、创建一个浏览学生“成绩表”的表单。
实训任务1:在编辑框中输出101~500之间的所有奇数,并将这些奇数之和显示在文本框中。实现方法:
Command1的Click事件代码:
s=0
for i=101 to 500
if i/2<>int(i/2)
thisform.edit1.value=thisform.edit1.value+" "+str(i,3)
s=s+i
endi
next
thisform.text1.value=s
Command2的Click事件代码:
thisform.release
实训任务2:求出所有小于或等于100的自然数对并显示在列表框中。(自然数对是指两个自然数的和与差都是平方数)
程序代码:
Command1的Click事件代码:
he=0
cha=0
x=""
for i=100 to 1 step-1
for j=1to i
cha=i-j
he=i+j
if sqrt(cha)=int(sqrt(cha)).and.sqrt(he)=int(sqrt(he))
x=str(i,3)+" "+str(j,3)
thisform.list1.additem(x)
endif
endfor
endfor
Command2的Click事件代码:
thisform.release
实训任务3:创建一个浏览学生“成绩表”的表单。实现方法:
if.not.bof()
skip-1
thisform.refresh()
endif
Command2的Click事件代码:
if.not.eof()
skip
thisform.refresh()
endif
Command3的Click事件代码:
thisform.release
实训任务二:
4、设计一个电话计费程序,表单窗口如图8.35所示,当单击“开始”则开始计时并显示开始时间,同时“开始”变为“结束”按钮,再单击“结束”,即结束通话并显示结束时间,同时“结束”变为“开始”按钮,单击“计费”则计算通话费并显示(假设每分钟通话费为0.15元)。
5、为第3题继续设计表单,要求再增加四个按钮:第一条、末一条、插入一条和删除一条。
6、输出“九九”乘法表,如图8.36所示。
7、设计一个查询表单如图8.37所示,当输入查询条件后,显示符合条件的“学生表”中的记录(可以进行模糊查询)。
实训任务4:设计一个电话计费程序,表单窗口如图8.35所示,当单击“开始”则开始计时并显示开始时间,同时“开始”变为“结束”按钮,再单击“结束”,即结束通话并显示结束时间,同时“结束”变为“开始”按钮,单击“计费”则计算通话费并显示(假设每分钟通话费为0.15元)。
实现方法:
Command1的Click事件代码:
publ t1,t2
if this.caption="开始"
bel5.caption=''
bel7.caption=''
bel9.caption=''
bel3.caption=time()
this.caption="结束"
mand2.enabled=.f.
t1=seconds()
else
bel5.caption=time()
this.caption="开始"
mand2.enabled=.t.
t2=seconds()
Command2的Click事件代码:
t=(t2-t1)/60
m=int(t)
if t<>m
m=m+1
endif
bel7.caption=str(m,2)
bel9.caption=str(0.15*m,5,2)
实训任务5:为第3题继续设计表单,要求再增加四个按钮:第一条、末一条、插入一条和删除一条。
Command1的Click事件代码:if.not.bof()
skip-1
thisform.refresh()
endif
Command2的Click事件代码:if.not.eof()
skip
thisform.refresh()
endif
Command3的Click事件代码:thisform.release
Command4的Click事件代码:go top
thisform.refresh()
Command5的Click事件代码:go bott
thisform.refresh()
Command6的Click事件代码:insert
Command7的Click事件代码:dele
pack
thisform.refresh()
实训任务6:输出“九九”乘法表,如图8.36所示。实现方法:
Command1的Click事件代码:
thisform.edit1.value="*"
for a=1to 9
thisform.edit1.value=thisform.edit1.value+" "+str(a,1) endfor
thisform.edit1.value=thisform.edit1.value+chr(13)