Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started