Question
6. Solution must be in C# ArgumentException is an existing class that derives from Exception; you use it when one or more of a methods
6. Solution must be in C#
ArgumentException is an existing class that derives from Exception; you use it when one or more of a methods arguments do not fall within an expected range. 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. In the Main() method, continuously prompt the user for data temperature, pass it to the method, and then display the following messages indicating whether the temperature is comfortable, not comfortable, or invalid:
X degrees is comfortable for swimming.
X degrees is not comfortable for swimming.
Value does not fall within the expected range.
SwimmingWaterTemperature.cs+ 1 sing Systern; 2 using static System.Console; 3 class SwimmingwaterTemperature 4 5 static void Main) 7 // Your code here 9 10 public static boolean CheckComfort(int temp) // your logic here 12 13
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started