Skip to main content

Practice ยท 3 of 4

Temperature scale

CHALLENGE
Difficulty: beginner+25 XP

Implement nested class Solution.Temperature: constructor (double celsius) throws ArgumentException below absolute zero (-273.15, exact boundary allowed); read-only Celsius; static factory FromFahrenheit(double f) converting with C = (F โˆ’ 32) ร— 5โ„9 and applying the same validation after conversion.

Back to lesson: Practice: Class workout