还有两道vb.net面试题,请大家帮忙,谢谢。 200

Question7ModulemodFree#Region"clsShape"PublicClassclsShapePrivatem_AreaAsDoublePrivat... Question 7

Module modFree
#Region "clsShape"
Public Class clsShape
Private m_Area As Double
Private m_Sides As Integer

Public Sub New()
m_Area = 0.0
m_Sides = 0
End Sub

Public Sub New(ByVal Sides As Integer)
m_Sides = Sides
End Sub

Public Sub New(ByVal Area As Double)
m_Area = Area
End Sub

Public Sub New(ByVal Area As Double, ByVal Sides As Integer)
m_Area = Area
m_Sides = Sides
End Sub

Public Property Area() As Double
Get
Return m_Area
End Get
Set(ByVal Value As Double)
m_Area = Value
End Set
End Property

Public Property Sides() As Integer
Get
Return m_Sides
End Get
Set(ByVal Value As Integer)
m_Sides = Value
End Set
End Property
End Class
#End Region

#Region "clsTriangle"
Public Class clsTriangle
Inherits clsShape

Public Sub New()
MyBase.New(3)
End Sub

Public Sub New(ByVal Area As Double)
MyBase.New(Area, 3)
End Sub

Public Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional ByVal AssignToArea As Boolean = False) As Double
Dim Area As Double = (SideBase * Height) / 2

If AssignToArea Then
Me.Area = Area
End If

Return Area
End Function
End Class
#End Region

Public Sub Main()
Dim objTriangle As New clsTriangle
Dim objShape As New clsShape

objTriangle.Area = -330
objTriangle.Sides = 5.5
objTriangle.CalculateArea(10.0, 2.5)

objShape.Area = 123
objShape.Sides = -2
objShape = CType(objShape, clsTriangle)

Console.WriteLine(TypeOf objTriangle Is clsShape)
Console.WriteLine(TypeOf objShape Is clsTriangle)
Console.WriteLine(objTriangle.Area)
End Sub
End Module

7.1 Please find the line of code from the procedure Main to cause run-time error.

Answer:

7.2 Please write the result output from the procedure Main.

Answer:

Question 8

Consider the following account and customer tables:

cust_tbl
cust_id title e_first_name e_last_name address1 .
0 MR Martin Ma .
1 MR Kirs Cheung .
2 MR Ricky Chan .
3 MR Tom Kwan .
4 MR Corporate Default Corporate Default .
5 MRS Mary Mok .
. . . . .

acc_grp_cust_tbl
acc_group Cust_id1 Cust_id2 Cust_id3 Cust_id4
1400 0 1 2
1500 3 4
1600 5
. . . . .
. . . . .

The acc_grp_cust_tbl table is responsible to store the customer ID, and the cust_tbl table is responsible to store customer personal information such as name, address, etc… Please write a SQL query in order to provide following result.

ACC_GROUP PAYEENAMES
1400 Ma Martin/Cheung Kris/Chan Ricky
1500 Kwan Tom/Corporate Default Corporate Default
1600 Mok Mary
. .
. .

Answer:
展开
 我来答
XnnYygn
2006-08-15 · TA获得超过751个赞
知道小有建树答主
回答量:1001
采纳率:0%
帮助的人:0
展开全部
我很喜欢这种题目
-------------------------------------------------------------------------
第7题,问题出在两方面
Public Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional

ByVal AssignToArea As Boolean = False) As Double
Dim Area As Double = (SideBase * Height) / 2
中间的 _ 有问题,应该去掉
还有objShape = CType(objShape, clsTriangle) 有错误,不能转换

注释掉objShape = CType(objShape, clsTriangle)
删除_后,得到结果
true
false
-330
--------------------------------------------------------------------------
第8题,就是以acc_grp_cust_tbl表为基础,查找cust_tbl并输出
一般的话使用涉及两个表的话使用SHAPE语句(以SQL为基础的语句)
虽然两者使用时差不多,但是理论比较难懂,我这里也不讲了,我使用ADO+SQL方法

先说明一下程序中的一个细节,也是问题比较容易忽略的
1400 0 1 2
1500 3 4
1600 5
说明一个问题Cust_id1 Cust_id2 Cust_id3 Cust_id4 字段不是数值,而是类似字符的东西(因为可能是

备注)

定义rsgrp对应acc_grp_cust_tbl ,rscust对应cust_tbl
预先设置好rsgrp和rscust的连接(使用VB的方法,可以移植到VB.NET上)

do until rscust.eof
strline=rscust(0) & " "
strSQL="SELECT * FROM CUST_TBL WHERE cust_id='" & RSGRP(1) & "' OR CUST_ID='" & RSGRP(2) & "' OR CUST_ID='" & RSGRP(3) & "' OR CUST_ID='" & RSGRP(4) & "'"
RSGRP.OPEN STRSQL
if rsgrp.recordcount>0 then
rsgrp.movefirst
do until rsgrp.eof
strLine=strline & rscust(3) & " " & rscust(2) & "/"
rsgrp.movenext
loop
end if
rscust.close
strline=left(strline ,len(strline)-1)
'去除最后一个"/"
console.writeline(strline)
loop
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
面试通
2024-11-19 广告
快速面试助手是武汉智联世界科技有限公司开发的高效面试工具。它利用人工智能技术,帮助HR和企业快速筛选简历,智能匹配岗位需求,实现初步面试自动化。通过预设问题库和自动评分系统,快速面试助手能大幅提升面试效率,减轻HR负担。同时,它还能提供面试... 点击进入详情页
本回答由面试通提供
百度网友738d17a0d
2006-08-22 · TA获得超过132个赞
知道答主
回答量:342
采纳率:0%
帮助的人:249万
展开全部
第7题,问题出在两方面
Public Function CalculateArea(ByVal SideBase As Double, ByVal --------------------------------------------------------------------------
第8题,就是以acc_grp_cust_tbl表为基础,查找cust_tbl并输出
一般的话使用涉及两个表的话使用SHAPE语句(以SQL为基础的语句)
虽然两者使用时差不多,但是理论比较难懂,我这里也不讲了,我使用ADO+SQL方法

先说明一下程序中的一个细节,也是问题比较容易忽略的
1400 0 1 2
1500 3 4
1600 5
说明一个问题Cust_id1 Cust_id2 Cust_id3 Cust_id4 字段不是数值,而是类似字符的东西(因为可能是

备注)

定义rsgrp对应acc_grp_cust_tbl ,rscust对应cust_tbl
预先设置好rsgrp和rscust的连接(使用VB的方法,可以移植到VB.NET上)

do until rscust.eof
strline=rscust(0) & " "
strSQL="SELECT * FROM CUST_TBL WHERE cust_id='" & RSGRP(1) & "' OR CUST_ID='" & RSGRP(2) & "' OR CUST_ID='" & RSGRP(3) & "' OR CUST_ID='" & RSGRP(4) & "'"
RSGRP.OPEN STRSQL
if rsgrp.recordcount>0 then
rsgrp.movefirst
do until rsgrp.eof
strLine=strline & rscust(3) & " " & rscust(2) & "/"
rsgrp.movenext
loop
end if
rscust.close
strline=left(strline ,len(strline)-1)
'去除最后一个"/"
console.writeline(strline)
loop
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
艾弗森II
2006-08-09 · TA获得超过483个赞
知道小有建树答主
回答量:1612
采纳率:0%
帮助的人:0
展开全部
Question 7

Module modFree
#Region "clsShape"
Public Class clsShape
Private m_Area As Double
Private m_Sides As Integer

Public Sub New()
m_Area = 0.0
m_Sides = 0
End Sub

Public Sub New(ByVal Sides As Integer)
m_Sides = Sides
End Sub

Public Sub New(ByVal Area As Double)
m_Area = Area
End Sub

Public Sub New(ByVal Area As Double, ByVal Sides As Integer)
m_Area = Area
m_Sides = Sides
End Sub

Public Property Area() As Double
Get
Return m_Area
End Get
Set(ByVal Value As Double)
m_Area = Value
End Set
End Property

Public Property Sides() As Integer
Get
Return m_Sides
End Get
Set(ByVal Value As Integer)
m_Sides = Value
End Set
End Property
End Class
#End Region

#Region "clsTriangle"
Public Class clsTriangle
Inherits clsShape

Public Sub New()
MyBase.New(3)
End Sub

Public Sub New(ByVal Area As Double)
MyBase.New(Area, 3)
End Sub

Public Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional ByVal AssignToArea As Boolean = False) As Double
Dim Area As Double = (SideBase * Height) / 2

If AssignToArea Then
Me.Area = Area
End If

Return Area
End Function
End Class
#End Region

Public Sub Main()
Dim objTriangle As New clsTriangle
Dim objShape As New clsShape

objTriangle.Area = -330
objTriangle.Sides = 5.5
objTriangle.CalculateArea(10.0, 2.5)

objShape.Area = 123
objShape.Sides = -2
objShape = CType(objShape, clsTriangle)

Console.WriteLine(TypeOf objTriangle Is clsShape)
Console.WriteLine(TypeOf objShape Is clsTriangle)
Console.WriteLine(objTriangle.Area)
End Sub
End Module

7.1 Please find the line of code from the procedure Main to cause run-time error.

Answer:

7.2 Please write the result output from the procedure Main.

Answer:

Question 8

Consider the following account and customer tables:

cust_tbl
cust_id title e_first_name e_last_name address1 .
0 MR Martin Ma .
1 MR Kirs Cheung .
2 MR Ricky Chan .
3 MR Tom Kwan .
4 MR Corporate Default Corporate Default .
5 MR Mary Mok .
. . . . .

acc_grp_cust_tbl
acc_group Cust_id1 Cust_id2 Cust_id3 Cust_id4
1400 0 1 2
1500 3 4
1600 5
. . . . .
. . . . .

The acc_grp_cust_tbl table is responsible to store the customer ID, and the cust_tbl table is responsible to store customer personal information such as name, address, etc… Please write a SQL query in order to provide following result.

ACC_GROUP PAYEENAMES
1400 Ma Martin/Cheung Kris/Chan Ricky
1500 Kwan Tom/Corporate Default Corporate Default
1600 Mok Mary
. .
. .

Answer:
你这不对,我改改!
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
zater02
2006-08-15 · TA获得超过161个赞
知道答主
回答量:166
采纳率:0%
帮助的人:91.5万
展开全部
郁闷 没学过
看得我眼花了。。。
不过
我很喜欢这种题目
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
斐念桃ci
2006-08-09 · 超过10用户采纳过TA的回答
知道答主
回答量:54
采纳率:0%
帮助的人:0
展开全部
ouch !!!!! oh,my god~~!!!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(10)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式