Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Function, Cost() to calculate the cost of purchasing gas for that trip,this info

ID: 3568333 • Letter: F

Question

Function, Cost() to calculate the cost of purchasing gas for that trip,this information in the table with the rest of the information. You will to add another parallel array ,TripCost,to hold this information. 37. Suppose a program contains the following function: Function F(X) As Float Set F = X + 1 End Function What is displayed when the statement Write F(3) in the main program is executed? 38. Given the function of Exercise 37, what is displayed when the Write F(F(0)) in the main program is executed? 39. Suppose a program contains the following function: Function G(X,Y) As Float Set G= X + Y End function

Explanation / Answer

37.

When F(3) is called, function's return value will be set to (3 + 1) = 4.

So, calling Write F(3) will give the output:

4

38.

when F(F(0)) is called, the inner function will execute first, thus, the inner function will have a return value of (0 + 1) = 1.

So, now out qquestion reduces to F(F(0)) = F(1).

So, the output will be:

2