Question: Write a Freezing Exception class.Also, write a TemperatureMonitor class that contains two methods:a ) The checkTemperature method can throw a FreezingException - If the temperature

Write a Freezing Exception class.Also, write a TemperatureMonitor class that contains two methods:a) The checkTemperature method can throw a FreezingException- If the temperature falls below 1 degree, it throws the exception with the message"Temperature is freezing!" otherwise, it prints "Temperature is normal" and prints the temperature value.b) The main method has an integer array of temperatures: 10,-5,20,-2,5Call the checkTemperature method in main that checks each temperature in the array if it is freezing or normal.

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 Databases Questions!