15.1k views
4 votes
g Write the application SwimmingWaterTemperature containing a variable that can hold a temperature expressed in degrees Fahrenheit. Within the class, create a method that accepts a parameter for a water temperature and returns true or false, indicating whether the water temperature is between 70 and 85 degrees and thus comfortable for swimming. If the temperature is not between 32 and 212 (the freezing and boiling points of water), it is invalid, and the method should throw an ArgumentException.

User Clhenrick
by
7.9k points

1 Answer

6 votes

Final answer:

The SwimmingWaterTemperature application should have a variable for holding a temperature in Fahrenheit and a method to check if the temperature is comfortable for swimming. An ArgumentException should be thrown for invalid temperatures.

Step-by-step explanation:

To write the application SwimmingWaterTemperature, you will need to create a class that contains a variable for holding a temperature expressed in degrees Fahrenheit. Within the class, you should create a method that accepts a parameter for a water temperature. This method should check if the temperature is between 70 and 85 degrees Fahrenheit, which is considered comfortable for swimming. If the temperature is not within the valid range of 32 to 212 degrees Fahrenheit, an ArgumentException should be thrown.

Learn more about SwimmingWaterTemperature

User VoidKing
by
8.5k points

No related questions found