In: Computer Science
CORAL Language Only:
Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value.
Ex: If the input is 50 60 140 200 75 100, the output is:
50 60 75
For coding simplicity, follow every output value by a space, including the last one.
Such functionality is common on sites like Amazon, where a user can filter results.
Your program should define and use a function:
Function outputIntsLessThanOrEqualToThreshold(integer array(?) userVals, integer upperThreshold) returns nothing
PLEASE GIVE IT A THUMBS UP, I SERIOUSLY NEED ONE, IF YOU NEED ANY MODIFICATION THEN LET ME KNOW, I WILL DO IT FOR YOU
Function outputIntsLessThanOrEqualToThreshold(integer array(?) userVals, integer upperThreshold) returns nothing
integer i
for i = 0; i < userVals.size; i = i + 1
if userVals[i]<=upperThreshold
Put userVals[i] to output
Put " " to output
Function Main() returns nothing
integer array(5) userVals
integer i
integer upperThreshold
for i = 0; i < userVals.size; i = i + 1
userVals[i]=Get next input
upperThreshold=Get next input
outputIntsLessThanOrEqualToThreshold(userVals,upperThreshold)