还有两道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: 展开
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: 展开
12个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询