Question: Write two specific functions that determine a maximum value. Each function is described below. Requirements: 1) The first function maxOfTwo should take two parameters and
Write two specific functions that determine a maximum value. Each function is described below. Requirements:
1) The first function maxOfTwo should take two parameters and return the greater of the two. Within the function there should be an if statement that determines which value to return.
2) The second function maxOfThree should take three parameters and return the largest of the three. It should call maxOfTwo twice to get the answer.
3) Setup
your code to call the functions with these values:
a) maxOfTwo( 5, 7 )
b) maxOfTwo( 105, 7 )
c) maxOfTwo( "yes", "no" )
d) maxOfThree( 8, 16, 1 )
e) maxOfThree( 28, 16, 1 )
f) maxOfThree( 28, 16, 106 )
g) maxOfTwo( False, 0 )
h) maxOfTwo( 0, False )
i) maxOfTwo( 0, "" )
4) The Preferred output is one result per line. You can either store the result of each call, then print it out; or call the functions directly from a print statement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
