Question: Quction In java language Goal: Leam to wite while loops with sentinels . Astagnment In a data analysis application for environmental studies, temperature readings from

Quction In java language
Goal: Leam to wite while loops with sentinels.
Astagnment In a data analysis application for environmental studies, temperature readings from a sensor are recorded in a sequence. Surden temperature spikes or drops are significant and are marked when the difference between one reading and the next exceeds 5 degrees.
White code that reads a sequence of temperature readings (as integers) from standard input, terminated by a negative number. The code should ident and count occurrences where the absolute difference between consecutive readings exceeds 5 degrees. After processing, print the count of such " significant changes.
For example, given the sequence "1215772216-1", the code should print "2" because there are two instances where consecutive readings differ more than 5 degrees (15 to 7 and 7 to 22).
Assume a scanner stdin object for standard input is provided.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!