1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetach [21]
3 years ago
11

ArgumentException is an existing class that derives from Exception; you use it when one or more of a method’s arguments do not f

all 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.
Computers and Technology
1 answer:
dybincka [34]3 years ago
7 0

Answer:

The C# code is given below

Explanation:

using System;

public class SwimmingWaterTemperatur

{

public static void Main()

{

while(true){

Console.Write("\nPlease enter the water temperature : ");

int x = Int32.Parse (Console.ReadLine());

try{

if(CheckComfort(x)){

Console.Write(x+" degrees is comfortable for swimming.");

}else{

Console.Write(x+" degrees is not comfortable for swimming.");

}

}catch(Exception ex){

Console.WriteLine(ex);

}

}

}

public static Boolean CheckComfort(int temp){

if(temp>=70 && temp<=85){

return true;

}else if(temp>=32 && temp<=212){

return false;

}else{

throw new ArgumentException("Value does not fall within the exptected range.");

}

}

}

You might be interested in
Given that<br>f(x) = 5x +3.<br>Find f (4)​
Vitek1552 [10]

Answer:

Given that

f(x) = 5x +3.

f (4)=5×4+3=23

3 0
3 years ago
Read 2 more answers
What is character referencing and why is it used?
Arturiano [62]

Answer: Character reference is the tool usually followed in the business world.It is defined as the recommendation that is provided by organization employee that has a relation with the candidate(individual) outside of the work. This also known as the personal reference. The candidate can be friend family or any other known person whose reference is being given.

This is used in the business field for revealing about the personality and character of the candidate apart from the skills and working abilities. It also helps in the hiring of the candidate easily when the description is good in the character reference.

6 0
3 years ago
Scientists measure an object’s mass in kilograms and its weight in newtons. If you knowthe amount of mass of an object in kilogr
Phoenix [80]

Answer:

public class WeightCalculator {

   

   private static DecimalFormat df2 = new DecimalFormat("#.##");

   

   public static void main(String args[]){

       //create scanner to receive user input

       Scanner in = new Scanner(System.in);

       //alert user to input mass

       System.out. println("Enter the Mass in Kg");

       //collect the input as a string

       String s = in. nextLine();

       //convert string to double and multiply by 9.8

       Double weight = Double.valueOf(s)* 9.8;

       

       //Print out answer formatted to 2 decimal place

       System.out. println("The Weight is " + df2.format(weight) + "N");

       

       //conditional statement to check if weight is less than 100

       if (weight < 100){

           System.out. println("Oops, it is too light");

       }

       //conditional statement to check if weight is more than 500

       if (weight > 500){

           System.out. println("Oops, it is too heavy");

       }            

   }

}

7 0
4 years ago
The method "someOtherMethod" is NOT defined as static. This means...
Verdich [7]

Answer:

3

Explanation:

7 0
3 years ago
In a large organization, how do you typically request permission to perform a network change?
kherson [118]

<em>Network change in larger organization follows hierarchy of approval. </em>

<em>Hierarchy of approval will start from the lowest department. The lowest department must prepare a written proposal, stating that there is a need for the network upgrade. Attachments such as proposed price list for the new equipments to buy also comes up with the proposal. Once that all documents are prepared, signatures from approval departments must be gathered. Each signature should be present and complete. </em>

<em> </em>

<em />

3 0
3 years ago
Other questions:
  • A Chief Information Officer (CIO) recently saw on the news that a significant security flaws exists with a specific version of a
    5·1 answer
  • What is the portrait mode?
    5·2 answers
  • Why is it more important now than ever before to know how to evaluate websites and other online sources of information?
    7·1 answer
  • How do i stream from my chromebook to my tv?
    8·1 answer
  • Somebody who is good at this stuff, please halp meh ;-;
    6·1 answer
  • You are working on a router that has established privilege levels that restrict access to certain functions. you discover that y
    5·1 answer
  • You must obey any special signs or instructions as you pass a construction zone.
    14·2 answers
  • A radiologist’s computer monitor has higher resolution than most computer screens. Resolution refers to the:______
    15·1 answer
  • Our readings so far explored computer hardware and software, in particular operating systems and application software. There are
    11·1 answer
  • Who is primarily responsible for ensuring cybersecurity in society? Select 3 options.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!