I need help understanding these problems, I have ten to answer. Determine the ou
ID: 3616110 • Letter: I
Question
I need help understanding these problems, I have ten to answer.
Determine the output displayed when the button is clicked.
1.
Dim num As Double = 7
AddTwo(num)
txtOutput.Text = CStr(num)
End Sub
Sub AddTwo(ByRef num As Double)
num += 2
End Sub
2.
Dim term As String = "Fall"
Plural(term)
txtOutput.Text = term
End Sub
Sub Plural(ByRef term As String)
'Concatenate the letter "s" to the value of term
term &= "s"
End Sub
3.
Dim dance As String
dance = "Can "
Twice(dance)
txtOutput.Text = dance
End Sub
Sub Twice(ByRef dance As String)
'Concatenate the value of dance to itself
dance &= dance
End Sub
4.
Dim a As Integer = 1, b As Integer = 3
lstOutput.Items.Add(a & " " & b)
Combine(a, b)
lstOutput.Items.Add(a & " " & b)
Combine((a), b)
lstOutput.Items.Add(a & " " & b)
End Sub
Sub Combine(ByRef x As Integer, ByVal y As Integer)
x = y - x
y = x + y
lstOutput.Items.Add(x & " " & y)
End Sub
5.
Dim a As Double = 5
Square(a)
txtOutput.Text = CStr(a)
End Sub
Sub Square(ByRef num As Double)
num = num * num
End Sub
6.
Dim name As String = "Terry Jones"
Abbreviate(name)
txtOutput.Text = name
End Sub
Sub Abbreviate(ByRef a As String)
Dim b As Integer = a.IndexOf("")
a = a.SubString(0, 1) & " . " & a.SubString(b + 1, 1) & "."
End Sub
7.
Dim word As String = ""
GetWord(word)
txtOutput.Text = "Less is " & word & "."
End Sub
Sub GetWord(ByRef w As String)
w = "more"
End Sub
8.
Dim hourlyWage, annualWage As Double
hourlyWage = 10
CalcAnnualWage(hourlyWage, annualWage)
txtOutput.Text = "Approximate Annual Wage: " & _
FormatCurrency(annualWage)
End Sub
Sub CalcAnnualWage(ByVal hWage As Double, ByRef aWage As Double)
'A year contains about 2000 work hours
aWage = 2000 * hWage
End Sub
9.
Dim name As String = ""
Dim yob As Integer
GetVita(name, yob)
txtOutput.Text = name & " was born in the year " & yob
End Sub
Sub GetVita(ByRef name As String, ByRef yob As Integer)
name = "Gabriel"
yob = 1980 'Year of birth
End Sub
10.
'Display a quotation
Dim word1, word2 As String
word1 = "fail"
word2 = "plan"
txtOutput.Text = "If you "
Sentence(word1, word2)
txtOutput.Text &= ","z
Exchange(word1, word2)
txtOutput.Text &= " then you "
Sentence(word1, word2)
txtOutput.Text &= "."
End Sub
Sub Exchange(ByRef word1 As String, ByRef word2 As String)
Dim temp As String
temp = word1
word1 = word2
word2 = temp
End Sub
Sub Sentence(ByVal word1 As String, ByVal word2 As String)
txtOutput.Text &= word1 & " to " & word2
End Sub
Explanation / Answer
x.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.