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
How can these requirements be met? Universal Containers conduct evaluations of their sales reps using a custom object consisting
Rudik [331]

Answer:

The answer is B. Use a private sharing model granting record access using custom setting; manage field access with page layouts and field level security

Explanation:

The answer is B. Use a private sharing model granting record access using custom setting; manage field access with page layouts and field level security.

The reason the answer is B is because if access is provided through a hierarchy, it will give access to all the users at the higher manager role for the records of every executive. Also the options provided do not state clearly if Grant access using hierarchy is also checked so we cant assume that.

4 0
3 years ago
Rows are typically represented by _______ and contain data for individual records
Agata [3.3K]
Records, data and tables are terns used in database software.Rows are typically presented by numbers and contain data for individual records. Records are used in database software to organize data. They are stored in tables.
4 0
3 years ago
Plz answer all the questions :)
AURORKA [14]

Answer:

is there multiple choice or do i have to answer from my own words??

7 0
3 years ago
What is the difference between a 13 column abacus and 5 column abacus?
Pepsi [2]

Answer:  The difference between these two types of abaci are the number the beads.

Explanation:

have a great day or night

4 0
2 years ago
Why are security measures protecting gdp data so strict?
Semenov [28]
The stock market would behave very differently if people had easy access to that data.
7 0
3 years ago
Other questions:
  • Variable names may contain spaces and punctuation symbols. True False
    15·1 answer
  • Discuss how and why video game hardware affects game design and where you think the next generation of platforms will change tho
    9·1 answer
  • 1. Which of the following should NOT be in a tagline?
    12·1 answer
  • What is 8 hours, 5 minutes, 22 seconds minus (-) 7 hours, 24 minutes, 37 seconds?
    6·1 answer
  • Company that offers Internet access to individuals and businesses. This device connects two or more networks and directs the flo
    11·1 answer
  • Suppose you present a project and your supervisor comments that the graphics need to be a higher quality and suggests you replac
    9·2 answers
  • Whay is processing?Explain with an example.​
    9·2 answers
  • [1] Our son has started playing organized T-ball, a beginner’s version of baseball. [2] “Organized” is what parents call it, any
    9·2 answers
  • What is DMTS. Explain it​
    10·2 answers
  • 9 dmz, vpn, vlan where in the network do you place a dmx, why, what attacks are prevented? what does a vpn do, provide an exampl
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!