Question: Task 3 : Demo [ 2 5 PTS ] Create a Demo class and in your main method, prompt the user to enter the temperature

Task 3: Demo [25 PTS]
Create a Demo class and in your main method, prompt the user to enter the temperature (Celsius or Fahrenheit) and the desired conversion (C to F or F to C):
Use a loop to allow repeated conversions until the user exits.
Read user input using Scanner.
Use a try-catch block to handle potential exceptions:
Inside the try block, call the appropriate conversion method (celsiusToFahrenheit or fahrenheitToCelsius) based on the user's selection.
In the catch block (catching TemperatureBelowAbsoluteZeroException), display an appropriate error message to the user and prompt them to enter a valid temperature.

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!