Use the pseudocode methods below to answer the questions in C++. FIRST METHOD: COMMENT parameters should be integers METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF END largestValue SECOND METHOD: COMMENT parameters should be doubles METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF RETURN result END largestValue THIRD METHOD: COMMENT parameters should be integers METHOD largestValue(parameters: num1, num2, num3) BEGIN IF(num1 >= num2 AND num1 >= num3) THEN result ← num1 ELSE IF (num2 >= num3) THEN result ← num2 ELSE result ← num3 ENDIF RETURN result END largestValue Given the pseudocode methods above and on the previous page, which method corresponds to each of the method calls specified? What would that method return based on the arguments listed? If nothing would be returned, please write “NO RETURN” in the box. CALL largestValue(6, 23, 4) ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD What would this method call return? CALL largestValue(5, 8) ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD What would this method call return? CALL largestValue(7.0, 9.3) ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD
Use the pseudocode methods below to answer the questions in C++.
FIRST METHOD: |
COMMENT parameters should be integers METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF END largestValue |
|
SECOND METHOD: |
COMMENT parameters should be doubles METHOD largestValue(parameters: num1, num2) BEGIN IF(num1 >= num2) THEN result ← num1 ELSE result ← num2 ENDIF RETURN result END largestValue |
|
THIRD METHOD: |
COMMENT parameters should be integers METHOD largestValue(parameters: num1, num2, num3) BEGIN IF(num1 >= num2 AND num1 >= num3) THEN result ← num1 ELSE IF (num2 >= num3) THEN result ← num2 ELSE result ← num3 ENDIF RETURN result END largestValue |
Given the pseudocode methods above and on the previous page, which method corresponds to each of the method calls specified? What would that method return based on the arguments listed? If nothing would be returned, please write “NO RETURN” in the box.
CALL largestValue(6, 23, 4) |
|
ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD |
What would this method call return?
|
|
|
CALL largestValue(5, 8) |
|
ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD |
What would this method call return?
|
|
|
CALL largestValue(7.0, 9.3) |
|
ࠪ FIRST METHOD ࠪ SECOND METHOD ࠪ THIRD METHOD |
What would this method call return?
|
Step by step
Solved in 3 steps