A fridge should keep food at a temperature between 0 and 5 degrees Celsius (inclusive). Assume you have a non-empty list of integer and/or floating-point numbers representing the hourly temperature readings, also in degrees Celsius. Print the list of all temperatures that are outside the allowed range. The answer box contains Pattern 2.3 (List filtering) as comments, to get you started. Write the corresponding code beneath each comment. Use variable names appropriate to the problem at hand instead of the generic names used by the pattern. The first step has been done for you. It uses an operation we defined for you, get_input() , to obtain the list used by each test. The list from get_input() is assigned to temperatures (which corresponds with the input_list in the pattern). You do not have to understand or work out how get_input() works. For example: Input Result [4.7] [] [5.2] [5.2] [0, 3, 5, 7, 5, 4, 2, 0, -0.2] [7, -0.2]

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question

A fridge should keep food at a temperature between 0 and 5 degrees Celsius (inclusive). Assume you have a non-empty list of integer and/or floating-point numbers representing the hourly temperature readings, also in degrees Celsius. Print the list of all temperatures that are outside the allowed range.

The answer box contains Pattern 2.3 (List filtering) as comments, to get you started. Write the corresponding code beneath each comment. Use variable names appropriate to the problem at hand instead of the generic names used by the pattern. The first step has been done for you. It uses an operation we defined for you,  get_input() , to obtain the list used by each test.

The list from get_input()  is assigned to temperatures (which corresponds with the input_list in the pattern).

You do not have to understand or work out how  get_input()  works.

For example:

Input Result
[4.7]
[]
[5.2]
[5.2]
[0, 3, 5, 7, 5, 4, 2, 0, -0.2]
[7, -0.2]
.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Lists
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage