Instructions ArgumentException is an existing class that derives from Exception; you use it when one or more of a method's arguments do not fall within an expected range. Write the application SwimmingWater Temperature 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. SwimmingWaterTemp... 1 using System; 2 using static System.Console; 3 class SwimmingWater Temperature 4 { 5 static void Main() 6 { 7 8 9 10 11 12 13} } // Your code here public static boolean CheckComfort(int temp) { // your logic here }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 2E
icon
Related questions
Question

In C#,

CENGAGE MINDTAP
Programming Exercise 11-2
0 Instructions
=
Labl
</>
ArgumentException is an existing class that derives
from Exception; you use it when one or more of a
method's arguments do not fall within an expected range.
Write the application SwimmingWater Temperature
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.
SwimmingWaterTemp...
1 using System;
2 using static System.Console;
3 class SwimmingWater Temperature
4 {
5
6
7
8
9
10
11
12
13}
+
static void Main()
{
}
// Your code here
public static boolean CheckComfort(int temp) {
// your logic here
}
Transcribed Image Text:CENGAGE MINDTAP Programming Exercise 11-2 0 Instructions = Labl </> ArgumentException is an existing class that derives from Exception; you use it when one or more of a method's arguments do not fall within an expected range. Write the application SwimmingWater Temperature 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. SwimmingWaterTemp... 1 using System; 2 using static System.Console; 3 class SwimmingWater Temperature 4 { 5 6 7 8 9 10 11 12 13} + static void Main() { } // Your code here public static boolean CheckComfort(int temp) { // your logic here }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT