Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 ) Prompt the user for three integers and three floats. Call them: int 1 , int 2 , int 3 , and float 1

1) Prompt the user for three integers and three floats. Call them: int1, int2, int3, and
float1, float2, float3.
2) There is a function called largest(first, second, third) that takes three numbers
and (finds and) returns the largest of the three numbers.
a. Call largest() using the integers 5,12, and 9 and display the result (largest number)
to the screen. You can call the function with largest(5,12,9).
b. Call largest() using int1, int2, int3 and display the largest to the screen.
c. Call largest() using float1, float2, float3 and display the largest to the
screen.
3) There is a function called average_three(first, second, third) that takes three
numbers and returns their average.
a. Call the function with the values 2.009,19.7 and 12.002 and display the result to
the screen.
b. Use average_three() to find the average of int1, int2, int3 and display
the result. Round to the nearest tenth.
c. Use average_three() to find the average of float1, float2, and display the
largest to the screen. Round to the nearest hundreth.
4) There is a function called mystery_fn() in the template file (and your PA version). HINT: Use
all integers!
a. Call mystery_fn() using int1, int2, int3 as arguments (in this order) and
display the results.
b. Call mystery_fn() using int3, int1, int2 as arguments (in this order) and
display the results.
c. Call mystery_fn() using int1 as all three arguments and display the results.
5) Test the odd_or_even() function with each integer value given by the user (int1, int2,
and int3) and display the results to the screen.
6) Lastly, determine if the results of mystery_fn() that you got in part 4 are odd or even.
Your output looks like:
What is the first integer?6
What is the second integer?5
What is the third integer?4
What is the first float?11.1
What is the second float?22.2
What is the third float?356.79
Largest is: 12
Largest is: 6
Largest is: 356.79
The average is: 11.237
The average is: 5.0
The average is: 130.03
The mystery result is: 4
The mystery result is: 5
The mystery result is: 0
6 is even
5 is odd
4 is even
First result is even
Second result is odd
Third result is even

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions