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
Which of the following techniques would a Baroque composer most likely employ to evoke an affect of agitation? Select one:
frez [133]

Answer:

b. Rubato tremolo

Explanation:

Tremolo is a modulation effect that imposes a rhythmic change in volume of sound. Once discovered in electric amplifier circuits, sound engineers and composers like the Baroque now use this low frequency oscillating modulation technique to create emotional piercing effect on their audience to maintain focus.

The low frequency tremolo can be gotten from the vibrating string in guitars, violins etc, and vocal sound, it is also produced from electronic devices created for its purpose. they are called optical tremolo.

5 0
3 years ago
Given a string variable named sentence that has been initialized , write an expression whose value is the the very last characte
Blizzard [7]
Strings can usually be dealt with as arrays of characters.

sentence[ -1 ]

sentence.substring( sentence.size() -1 );
8 0
3 years ago
Chris is working with other employees on a worksheet. the other employees have made comments, but they are not visible.
andriy [413]

Answer:

a. select show all comments on the review tab

Explanation:

Please mark me brainliest if correct

7 0
2 years ago
If you use your smartphone as a hotspot to connect to the Internet on your tablet you are using a ________.quillet
Nataly [62]
Personal Area Network
7 0
2 years ago
Explain the reason why vector graphics are highly recommended for logo​
Verdich [7]

Answer:

Currently, raster (bitmap files) and vector graphics are used in web design. But if you want to make a great logo and fully enjoy the use of it you should pick vector graphics for it in the first place. And this is why most designers opt for it.

Explanation:

  • Easier to re-edit
  • No image distortion
  • It is perfect for detailed images
  • Vector drawings are scalable
  • Vector graphics look better in print
7 0
3 years ago
Other questions:
  • ASAP HELP NO GUESS A new pet store wants to design a logo to be displayed on business cards, posters in the shop’s windows, and
    9·2 answers
  • Which of the following is not a typical step in the ethical hacking process? A. Planning B. Discovery C. Attack D. Recovery
    5·1 answer
  • Apple users tend to like the company and love its products. Apple has successfully nurtured this __________ component of its cus
    15·1 answer
  • To expand the interface within CengageNOWv2, you need to click on the:_______.
    15·1 answer
  • What information is displayed in the title bar?
    10·1 answer
  • In the Programming Process which of the following is not involved in defining what the program is to do:_____________ Group of a
    10·1 answer
  • Linda wants to apply for a job in a company of her choice. Which information would her potential employers likely review in her
    10·2 answers
  • A browser allows you to set preferences for using the browser. These preferences include all of the following except
    7·1 answer
  • Define the instance method inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for th
    6·1 answer
  • Need answer ASAP!!!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!