I\'m working on a project and need the following answered. Please help. My deadl
ID: 3626997 • Letter: I
Question
I'm working on a project and need the following answered. Please help. My deadline is tomorrow by midnight.
8.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a(3), b(3) As Integer
Dim c(3) As Double
Private Sub btnDisplay_Click(....) Handles btnDisplay.Click
Dim sr As IO.StreamReader = IO.File.OpenTexas("DATA.TXT")
For i As Integer = 0 To 3
a(i) = CInt(sr.ReadLine)
b(i) = CInt(sr.ReadLine)
Next
sr.Close()
For i As Integer = 0 To c.GetUpperBound(0)
c(i) = a(i) * b(i)
lstOutput.Items.Add(c(i))
Next
End Sub
End Class
(Assume that the eight lines of the file DATA.TXT contain the following entries: 2,5,3,4,1,3,7,2.)
10.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim average As Double
ReDim grade(3)
grade(2) = 70
grade(3) = 80
average = (grade(0) + grade(1) + grade(2) + grade(3)) / 4
txtOutput.Text = "Your average is " & average
End Sub
12.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim band() As String = {"soloist", "duet", "trio", "quartet"}
Private Sub btnDisplay_Click(....) Handles btnDisplay.Click
Dim num As Integer
ReDim Preserve band(9)
band(4) = "quintet"
band(5) = "sextet"
band(6) = InputBox("What do you call a group of 7 musicians")
Num = CInt(InputBox("How many musicians are in your group?"))
txtOutput.Text = "You have a " & band(num - 1) & "."
End Sub
End Class
(Assume that the first response is septet and the second response is 3.)
14.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p(100) As Double
Private Sub btnDisplay_Click(....) Handles btnDisplay.Click
For i As Integer = 0 To 200
p(i) = 1 / 2
Next
End Sub
End Class
Explanation / Answer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a(3), b(3) As Integer
Dim c(3) As Double
Dim sr As IO.StreamReader = IO.File.OpenTexas("DATA.TXT")
For i As Integer = 0 To 3
a(i) = CInt(sr.ReadLine)
b(i) = CInt(sr.ReadLine)
Next
sr.Close()
For i As Integer = 0 To c.GetUpperBound(0)
c(i) = a(i) * b(i)
lstOutput.Items.Add(c(i))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim average As Double
ReDim grade(3)
grade(0) = 70
grade(1) = 80
grade(2) = 70
grade(3) = 80
average = (grade(0) + grade(1) + grade(2) + grade(3)) / 4
txtOutput.Text = "Your average is " & average
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim band() As String = {"soloist", "duet", "trio", "quartet"}
Dim num As Integer
ReDim Preserve band(9)
band(4) = "quintet"
band(5) = "sextet"
band(6) = InputBox("What do you call a group of 7 musicians")
num = CInt(InputBox("How many musicians are in your group?"))
txtOutput.Text = "You have a " & band(num - 1) & "."
End Sub
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p(100) As Double
For i As Integer = 0 To 200
p(i) = 1 / 2
Next
End Sub
End Class