Question: 1 1 . 3 3 LAB: User - Defined Functions: Output values below an amount Define a function named outputIntsLessThanOrEqualToThreshold that takes two parameters: an
LAB: UserDefined Functions: Output values below an amount
Define a function named outputIntsLessThanOrEqualToThreshold that takes two parameters: an array of integers and an integer representing a threshold value. Function outputIntsLessThanOrEqualToThreshold outputs all integers in the array that are less than or equal to the threshold value.
Write a main program that reads six integers from input. The first five values are stored in an array. The last value is the upper threshold. Then the program calls function outputIntsLessThanOrEqualToThreshold with the array and threshold as arguments. Function outputIntsLessThanOrEqualToThreshold will output the results.
Ex: If the input is:
where and are values in an array. is the threshold value. The output is:
For coding simplicity, follow every output value by a space, including the last one.
Your program should define and use a function:
Function outputIntsLessThanOrEqualToThresholdinteger array userVals, integer upperThreshold returns nothing
Such functionality is common on sites like Amazon, where a user can filter results.
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
