Please assist, thank you! Exercise 9-3: Writing Procedures that Require Multiple
ID: 3772451 • Letter: P
Question
Please assist, thank you!
Exercise 9-3: Writing Procedures that Require Multiple Parameters
In this exercise, you use what you have learned about writing procedures that require multiple parameters to answer Questions 1–2.
1.
Given the following procedure calls, write the procedure’s header:
a.Dim Name As String Dim Address As String printLabel(Name, Address)_____________________________________________________________
b.Dim Side1 As Double Dim Side2 As Double calculateRectangleArea(Side1, Side2)_____________________________________________________________
c.Dim Day As Integer Dim Month As Integer Dim Year As Integer birthdayInvitation(Day, Month, Year) _____________________________________________________________
2.
Given the following procedure headers, write a procedure call:
a.Sub printBill(ByVal Name As String, _ ByVal Balance As Double)_______________________________________________________________
b.Sub findProduct(ByVal Num1 As Integer, _ ByVal Num2 As Integer)__________________________________________________________________
c.Sub newBalance(ByVal Bal As Double, _ ByVal Interest As Double)__________________________________________________________________
Explanation / Answer
1.
When writing procedures the format of procedure
Sub procedureName(ByVal variableName1 as dataType,
ByVal variableName2 as dataType)
a.
Procedure header for printLabel
Sub printLabel(ByVal Name as String , ByVal Address as String)
b.
Procedure header for calculateRectangleArea
Sub calculateRectangleArea(ByVal Side1 as Double , ByVal Side2 as Double)
c.
Procedure header for birthdayInvitation
Sub birthdayInvitation(ByVal Day as Integer,
ByVal Month as Integer, ByVal Year as Integer)
------------------------------------------------------------------------------------------
2.
Procedure calls
When writting procedure calls call method name of procedure call
with variable names without type of data
a. Procedure call for the header
Sub printBill(ByVal Name As String, ByVal Balance As Double)
is printBill(Name,Balance)
b.Procedure call for the header
Sub findProduct(ByVal Num1 As Integer, ByVal Num2 As Integer) is
findProduct(Num1,Num2)
c.
Procedure call for the header
Sub newBalance(ByVal Bal As Double, ByVal Interest As Double) is
newBalance(Bal, Interest)