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
Arisa [49]
3 years ago
13

I need to create a method named "root positive". which will either print the square root of the number passed to it or if the nu

mber is less than zero, it will print out the statement "Number must not be negative."?
1. Ask the user to input a number of type double which you will find the square root of the number.

2. Create a method called rootPositive which will either print the square root of the number passed to it or if the number is less than zero, it will print out the statement "Number must not be negative.".

3. Call your rootPositive method and pass to it the number the user enetered.
Computers and Technology
1 answer:
rjkz [21]3 years ago
5 0

Answer:

Explanation:

The following code is written in Java. It is a method that calculates the square root of a number as requested. The method first checks with an IF statement if the parameter value is a positive number and then calculates the square root and prints it to the screen. Otherwise, it prints Number must not be negative. A test case has been provided in the main method and the output can be seen in the attached image below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.print("Enter a number of type double to calculate square root:");

       double num = in.nextDouble();

       rootPositive(num);

   }

   public static void rootPositive(double num) {

       if (num > 0) {

           System.out.println(Math.sqrt(num));

       } else {

           System.out.println("Number must not be negative.");

       }

   }

}

You might be interested in
David wanted to build a Temple for God in________
Leona [35]

Answer: The answer would be Bethlehem!

4 0
3 years ago
Read 2 more answers
In a class hierarchy,
kondor19780726 [428]

Answer:

The correct answer to the following question will be Option D.

Explanation:

  • A collection of nested title scopes are defined by the class hierarchy, even though a collection of nested methodologies as well as blocks see in an everything else.
  • From the all, the lexical role characterizes the connection between certain scopes of names - if method d would be decided to declare somewhere within procedure c, therefore the namespace within the namespace of c would be nested.
  • The more common classes in such a family hierarchy were near the peak of the tree as well as more specific classes are towards the edges.

Other choices have no connection with the given situation. So Option D seems to be the right response.

4 0
3 years ago
Which is an example,of an input devices? Choose the answer.
Alenkasestr [34]

Answer:

microphone

Explanation:

You have to plug in microphones, and if you plug it in, it is considered an input.

3 0
3 years ago
The bindery process of cutting irregular shapes and patterns in press sheets is called what?
konstantin123 [22]
B. Die cutting. Typically a metal die with various shapes and patterns is rolled over paper, cardboard, etc to punch out.
3 0
4 years ago
You found an image on the Creative Commons that you would like to use. How do you give credit to the author? *
Archy [21]
You need to write the author’s name
7 0
3 years ago
Read 2 more answers
Other questions:
  • When typing in a cell, hitting Tab will bring which result?
    12·2 answers
  • If the force of gravity _ then the weight of an object will _
    8·2 answers
  • Consider two different implementations, M1 and M2, of the same instruction set. There are three classes of instructions (A, B, a
    14·1 answer
  • the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
    7·2 answers
  • : Show that the propositions (p ∨ q) ∧ (¬p ∨ r) and (p ∧ r) ⊕ (¬p ∧ q) are logically equivalent.
    6·1 answer
  • What is Adobe Dreamweaver ? What is it used for ? Name and describe its major components and features in detail​
    15·1 answer
  • Which object event is an indication that something has been created but not committed into the database?
    13·1 answer
  • What If smart phones / computers didn't exist? <br>​
    5·1 answer
  • Write a program to input a number and check whether it is even or odd number
    7·1 answer
  • Write the application of computer in education and communication​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!