please assist, thank you Exercise 9-4: Writing Functions that Return Value In th
ID: 3772452 • Letter: P
Question
please assist, thank you
Exercise 9-4: Writing Functions that Return Value
In this exercise, you use what you have learned about writing functions that return a value to answer Questions 1–2.
1.
Given the following variable declarations and function calls, write the function’s header:
a.Dim Price As Double Dim Percent As Double Dim NewPrice As Double NewPrice = calculateNewPrice(Price, Percent)_____________________________________________________________________________
b.Dim Area As Double Dim OneLength As Double Dim TwoLength As Double Area = calcArea(OneLength, TwoLength) _____________________________________________________________________________
c.Dim LowerCase As String Dim UpperCase As String UpperCase = changeCase(LowerCase)_____________________________________________________________________________
2.
Given the following function headers, write a function call:
a.Function findItem(ByVal ItemNumber _ As Integer) As String_____________________________________________________________________________
b.Function cubed(ByVal Num1 As Integer, _ ByVal Num2 As Integer) As Integer_____________________________________________________________________________
c.Function power(ByVal Num As Integer, _ ByVal Exp As Integer) As Integer_____________________________________________________________________________
Explanation / Answer
Answer `1)
a)double dim_price;
double dim_percent;
double new_price;
new_price=calculate_newprice(dim_price,dim_percent); /* function call to calculate_newprice method */
Function Header: double calculate_newprice( double dim_price, double dim_percent);
b)
double dim_area;
double dim_onelength;
double dim_twolength;
dim_area=calcArea(dim_onelength,dim_twolength) ; /* function call to the method */
Function Header: double calcArea(double dim_onelength,double dim_twolength);
c)
String dim_lowercase;
String dim_uppercase;
uppercase=changeCase(dim_lowercase); ->function call
Function Header: double changeCase(double dim_lowercase);
Answer 2) The following are the function calls:
a)findItem(itemNumber);
b)cubed(num1,num2);
c)power(Num,Exp);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.