Please assist, thank you! Exercise 9-2: Writing Procedures that Require a Single
ID: 3772449 • Letter: P
Question
Please assist, thank you!
Exercise 9-2: Writing Procedures that Require a Single Parameter
In this exercise, you use what you have learned about writing procedures that require a single parameter to answer Questions 1–2.
1.
Given the following variable declarations and procedure calls, write the procedure’s header:
a.Dim Name As String printNameBadge(Name)_______________________________________________________________
b.Dim SideLength As Double calculateSquareArea(SideLength)_______________________________________________________________
c.Dim Minutes As Integer displaySecondsInMinutes(Minutes)_______________________________________________________________
2.
Given the following procedure headers, write a procedure call:
a.Sub displayPetName(ByVal PetName As String)_______________________________________________________________
b.Sub printBirthdays(ByVal Month As Integer)_______________________________________________________________
c.Sub checkValidPassword(ByVal Password As String)_______________________________________________________________
Explanation / Answer
Answer for Question 1 is:
a.Dim Name As String printNameBadge(Name)
Ans:
Dim Name = "Hello"
call printNameBadge(Name)
Sub printNameBadge(By Value Name)
msgbox "Name"
End Sub
b: Dim SideLength As Double calculateSquareArea(SideLength)
Ans:
Dim SideLength = 10
call calculateSquareArea(SideLength)
Sub calculateSquareArea(By Value SideLength)
temp = SideLength * SideLength
msgbox "temp * "
End Sub
b: Dim Minutes As Integer displaySecondsInMinutes(Minutes)
Ans:
Dim SideLength = 10
call displaySecondsInMinutes(Minutes)
Sub displaySecondsInMinutes(By Value Minutes)
temp = 60 * Minutes
msgbox "temp * "
End Sub
Answer for Question 2 is:
a: Sub displayPetName(ByVal PetName As String)
Ans:
Sub displayPetName(ByVal PetName As String)
msgbox "PetName"
End Sub
b: Sub printBirthdays(ByVal Month As Integer)
Ans:
Sub printBirthdays(ByVal Month As Integer)
msgbox "Month"
End Sub
b: Sub checkValidPassword(ByVal Password As String)
Ans:
Sub checkValidPassword(ByVal Password As String)
msgbox "Password"
End Sub