Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

visual basic What is the output of the following program when the button is clicked on ? Private Sub btnDisplay _ Click ( . .

visual basic What is the output of the following program when the button is clicked on?
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim result As Double
Dim number(4) As Double
FillArray(number)
result = SumArray(number)
txtBox.Text = CStr(result)
End Sub
Sub FillArray(anyArray() As Double)
Dim temp() As String = IO.File.ReadAllLines("Data.txt")
For i As Integer =0 To 4
anyArray(i)= CDbl(temp(i))
Next
End Sub
Function SumArray(anyArray() As Double) As Double
Dim total As Double
total =0
For i As Integer =0 To 4 Step 2
total += anyArray(i)
Next
Return total
End Function
Assume the five rows of the file Data.txt contain the following entries: 1,3,5,7,9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions