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
umka21 [38]
3 years ago
3

NOTE: in mathematics, the square root of a negative number is not real; in Java therefore, passing such a value to the square ro

ot function returns a value known as NaN (not-a-number). Given a double variable named areaOfSquare write the necessary code to read in a value, the area of some square, into areaOfSquare and print out the length of the side of that square. HOWEVER: if any value read in is not valid input, just print the message "INVALID". ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input.
Computers and Technology
1 answer:
Anestetic [448]3 years ago
7 0

Answer:

// program in java.

import java.util.*;

// class definition

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input

Scanner scr=new Scanner(System.in);

System.out.print("Enter area of square: ");

// read the area of square  

double areaOfSquare=scr.nextDouble();

// if area is negative

if(areaOfSquare<0)

{

// print Invalid

System.out.println("INVALID");

}

// else find side of the square and print it.

else

System.out.println("The side of the square is: "+Math.sqrt(areaOfSquare));

     

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the area of square from user and assign it to variable "areaOfSquare". If the area entered by user is negative then print "INVALID" otherwise find the  side of the square with Math.sqrt() function and print it.

Output:

Enter area of square: -4                                                                                                  

INVALID

Enter area of square: 25                                                                                                  

The side of the square is: 5.0

You might be interested in
What is the command to list the contents of directors in Unix- like operating system
maks197457 [2]

Answer:

Ls command

Explanation:

The command to list the contents of directory in Unix- like operating system is "Ls command."

In computer programming, the "Ls command" is commonly found in the EFI shell and other environments, including DOS, OS/2, Microsoft Windows, Matlab and, -GNU Octave.

The "Ls" command is used in writing to the standard outcome, such as the contents of each specified Directory or any other information

3 0
3 years ago
Thomas owns a small Web services company and currently owns and maintains all his own computing hardware. He plans to develop an
Stels [109]

Answer: Hello the options related to your question is missing attached below are the options

answer : unlimited computing capacity for a low monthly fee ( A )

Explanation:

Since Thomas plans to develop a new service that will require his computing capacity to either double or triple, The best way of transitioning to the public cloud that might help Thomas meet up the requirement is Using unlimited computing capacity for a low monthly fee

7 0
3 years ago
How much data do sensors collect?<br>​
Thepotemich [5.8K]

Safety sensors in mining operations can generate up to 2,4 terabits (TB) of data every minute. Sensors in one smart-connected home can produce as much as 1 gigabyte (GB) of information a week.

3 0
3 years ago
Read 2 more answers
What technology is used with building a closet organizer?
vaieri [72.5K]

Answer:builder

Explanation:

4 0
4 years ago
Read 2 more answers
Name the different type of vegetation found in India ?​
maw [93]
Tropical Rainforests, Tropical Deciduous Forests, Tropical Thorn Forests and Scrubs, Montane Forests and Mangrove Forests.
4 0
3 years ago
Read 2 more answers
Other questions:
  • The system tray contains _____.
    7·2 answers
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    12·2 answers
  • B. Write a function that takes one double parameter, and returns a char. The parameter represents a grade, and the char represen
    7·1 answer
  • what is a conditional format that displays a horizontal gradient or solid fill indicating the cell's relitive value compared to
    6·1 answer
  • What is the current when the voltage is 18 volts and the resistance is 6 ohms?
    7·1 answer
  • Rene has added to touches and shoulder stretches to his warm up routine these activities are most likely to improve his
    15·1 answer
  • End-user computer refers to a group of end users working together to manage their interactions with a computer.
    10·1 answer
  • Answer this correct and get brainly
    5·2 answers
  • 13. A 2-sided coin has an equal likelihood of landing on each side. One side is called "heads" and the other is called "tails".
    11·1 answer
  • Does anyone know what's wrong with this code in Unity? HELP FAST PLEASE! This is for my game design course, I will give brainies
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!